Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@web3auth/base

Package Overview
Dependencies
Maintainers
3
Versions
123
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@web3auth/base - npm Package Compare versions

Comparing version 9.0.0-alpha.0 to 9.0.0-alpha.1

14

dist/base.cjs.js

@@ -610,3 +610,3 @@ /******/ (() => { // webpackBootstrap

const MULTI_CHAIN_ADAPTERS = {
OPENLOGIN: "openlogin",
AUTH: "auth",
WALLET_CONNECT_V2: "wallet-connect-v2",

@@ -616,9 +616,6 @@ SFA: "sfa"

const SOLANA_ADAPTERS = objectSpread2_default()({
TORUS_SOLANA: "torus-solana",
PHANTOM: "phantom",
SOLFLARE: "solflare"
TORUS_SOLANA: "torus-solana"
}, MULTI_CHAIN_ADAPTERS);
const EVM_ADAPTERS = objectSpread2_default()({
TORUS_EVM: "torus-evm",
METAMASK: "metamask",
COINBASE: "coinbase"

@@ -628,10 +625,7 @@ }, MULTI_CHAIN_ADAPTERS);

const ADAPTER_NAMES = {
[MULTI_CHAIN_ADAPTERS.OPENLOGIN]: "OpenLogin",
[MULTI_CHAIN_ADAPTERS.AUTH]: "Auth",
[MULTI_CHAIN_ADAPTERS.WALLET_CONNECT_V2]: "Wallet Connect v2",
[MULTI_CHAIN_ADAPTERS.SFA]: "SFA",
[SOLANA_ADAPTERS.TORUS_SOLANA]: "Torus",
[SOLANA_ADAPTERS.PHANTOM]: "Phantom",
[SOLANA_ADAPTERS.SOLFLARE]: "Solflare",
[EVM_ADAPTERS.TORUS_EVM]: "Torus",
[EVM_ADAPTERS.METAMASK]: "Metamask",
[EVM_ADAPTERS.COINBASE]: "Coinbase"

@@ -942,3 +936,3 @@ };

5210: "Wallet Services Plugin is not initialized",
5211: "Web3Auth is connected to unsupported adapter. Wallet services connector plugin requires web3auth connected to openlogin adapter.",
5211: "Web3Auth is connected to unsupported adapter. Wallet services connector plugin requires web3auth connected to auth adapter.",
5212: "Provider is required..",

@@ -945,0 +939,0 @@ 5213: "Web3Auth instance is required while initialization.",

@@ -506,3 +506,3 @@ import _defineProperty from '@babel/runtime/helpers/defineProperty';

const MULTI_CHAIN_ADAPTERS = {
OPENLOGIN: "openlogin",
AUTH: "auth",
WALLET_CONNECT_V2: "wallet-connect-v2",

@@ -512,9 +512,6 @@ SFA: "sfa"

const SOLANA_ADAPTERS = _objectSpread({
TORUS_SOLANA: "torus-solana",
PHANTOM: "phantom",
SOLFLARE: "solflare"
TORUS_SOLANA: "torus-solana"
}, MULTI_CHAIN_ADAPTERS);
const EVM_ADAPTERS = _objectSpread({
TORUS_EVM: "torus-evm",
METAMASK: "metamask",
COINBASE: "coinbase"

@@ -524,10 +521,7 @@ }, MULTI_CHAIN_ADAPTERS);

const ADAPTER_NAMES = {
[MULTI_CHAIN_ADAPTERS.OPENLOGIN]: "OpenLogin",
[MULTI_CHAIN_ADAPTERS.AUTH]: "Auth",
[MULTI_CHAIN_ADAPTERS.WALLET_CONNECT_V2]: "Wallet Connect v2",
[MULTI_CHAIN_ADAPTERS.SFA]: "SFA",
[SOLANA_ADAPTERS.TORUS_SOLANA]: "Torus",
[SOLANA_ADAPTERS.PHANTOM]: "Phantom",
[SOLANA_ADAPTERS.SOLFLARE]: "Solflare",
[EVM_ADAPTERS.TORUS_EVM]: "Torus",
[EVM_ADAPTERS.METAMASK]: "Metamask",
[EVM_ADAPTERS.COINBASE]: "Coinbase"

@@ -806,3 +800,3 @@ };

5210: "Wallet Services Plugin is not initialized",
5211: "Web3Auth is connected to unsupported adapter. Wallet services connector plugin requires web3auth connected to openlogin adapter.",
5211: "Web3Auth is connected to unsupported adapter. Wallet services connector plugin requires web3auth connected to auth adapter.",
5212: "Provider is required..",

@@ -809,0 +803,0 @@ 5213: "Web3Auth instance is required while initialization.",

@@ -1,1 +0,1 @@

!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.Base=t():e.Base=t()}(self,(()=>(()=>{var e={743:e=>{"use strict";var t=function(e){return function(e){return!!e&&"object"==typeof e}(e)&&!function(e){var t=Object.prototype.toString.call(e);return"[object RegExp]"===t||"[object Date]"===t||function(e){return e.$$typeof===r}(e)}(e)},r="function"==typeof Symbol&&Symbol.for?Symbol.for("react.element"):60103;function n(e,t){return!1!==t.clone&&t.isMergeableObject(e)?s((r=e,Array.isArray(r)?[]:{}),e,t):e;var r}function o(e,t,r){return e.concat(t).map((function(e){return n(e,r)}))}function i(e){return Object.keys(e).concat(function(e){return Object.getOwnPropertySymbols?Object.getOwnPropertySymbols(e).filter((function(t){return Object.propertyIsEnumerable.call(e,t)})):[]}(e))}function a(e,t){try{return t in e}catch(e){return!1}}function s(e,r,c){(c=c||{}).arrayMerge=c.arrayMerge||o,c.isMergeableObject=c.isMergeableObject||t,c.cloneUnlessOtherwiseSpecified=n;var l=Array.isArray(r);return l===Array.isArray(e)?l?c.arrayMerge(e,r,c):function(e,t,r){var o={};return r.isMergeableObject(e)&&i(e).forEach((function(t){o[t]=n(e[t],r)})),i(t).forEach((function(i){(function(e,t){return a(e,t)&&!(Object.hasOwnProperty.call(e,t)&&Object.propertyIsEnumerable.call(e,t))})(e,i)||(a(e,i)&&r.isMergeableObject(t[i])?o[i]=function(e,t){if(!t.customMerge)return s;var r=t.customMerge(e);return"function"==typeof r?r:s}(i,r)(e[i],t[i],r):o[i]=n(t[i],r))})),o}(e,r,c):n(r,c)}s.all=function(e,t){if(!Array.isArray(e))throw new Error("first argument should be an array");return e.reduce((function(e,r){return s(e,r,t)}),{})};var c=s;e.exports=c},46:e=>{"use strict";var t,r="object"==typeof Reflect?Reflect:null,n=r&&"function"==typeof r.apply?r.apply:function(e,t,r){return Function.prototype.apply.call(e,t,r)};t=r&&"function"==typeof r.ownKeys?r.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.getOwnPropertyNames(e)};var o=Number.isNaN||function(e){return e!=e};function i(){i.init.call(this)}e.exports=i,e.exports.once=function(e,t){return new Promise((function(r,n){function o(r){e.removeListener(t,i),n(r)}function i(){"function"==typeof e.removeListener&&e.removeListener("error",o),r([].slice.call(arguments))}m(e,t,i,{once:!0}),"error"!==t&&function(e,t){"function"==typeof e.on&&m(e,"error",t,{once:!0})}(e,o)}))},i.EventEmitter=i,i.prototype._events=void 0,i.prototype._eventsCount=0,i.prototype._maxListeners=void 0;var a=10;function s(e){if("function"!=typeof e)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof e)}function c(e){return void 0===e._maxListeners?i.defaultMaxListeners:e._maxListeners}function l(e,t,r,n){var o,i,a,l;if(s(r),void 0===(i=e._events)?(i=e._events=Object.create(null),e._eventsCount=0):(void 0!==i.newListener&&(e.emit("newListener",t,r.listener?r.listener:r),i=e._events),a=i[t]),void 0===a)a=i[t]=r,++e._eventsCount;else if("function"==typeof a?a=i[t]=n?[r,a]:[a,r]:n?a.unshift(r):a.push(r),(o=c(e))>0&&a.length>o&&!a.warned){a.warned=!0;var u=new Error("Possible EventEmitter memory leak detected. "+a.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");u.name="MaxListenersExceededWarning",u.emitter=e,u.type=t,u.count=a.length,l=u,console&&console.warn&&console.warn(l)}return e}function u(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function p(e,t,r){var n={fired:!1,wrapFn:void 0,target:e,type:t,listener:r},o=u.bind(n);return o.listener=r,n.wrapFn=o,o}function d(e,t,r){var n=e._events;if(void 0===n)return[];var o=n[t];return void 0===o?[]:"function"==typeof o?r?[o.listener||o]:[o]:r?function(e){for(var t=new Array(e.length),r=0;r<t.length;++r)t[r]=e[r].listener||e[r];return t}(o):f(o,o.length)}function h(e){var t=this._events;if(void 0!==t){var r=t[e];if("function"==typeof r)return 1;if(void 0!==r)return r.length}return 0}function f(e,t){for(var r=new Array(t),n=0;n<t;++n)r[n]=e[n];return r}function m(e,t,r,n){if("function"==typeof e.on)n.once?e.once(t,r):e.on(t,r);else{if("function"!=typeof e.addEventListener)throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof e);e.addEventListener(t,(function o(i){n.once&&e.removeEventListener(t,o),r(i)}))}}Object.defineProperty(i,"defaultMaxListeners",{enumerable:!0,get:function(){return a},set:function(e){if("number"!=typeof e||e<0||o(e))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+e+".");a=e}}),i.init=function(){void 0!==this._events&&this._events!==Object.getPrototypeOf(this)._events||(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},i.prototype.setMaxListeners=function(e){if("number"!=typeof e||e<0||o(e))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+e+".");return this._maxListeners=e,this},i.prototype.getMaxListeners=function(){return c(this)},i.prototype.emit=function(e){for(var t=[],r=1;r<arguments.length;r++)t.push(arguments[r]);var o="error"===e,i=this._events;if(void 0!==i)o=o&&void 0===i.error;else if(!o)return!1;if(o){var a;if(t.length>0&&(a=t[0]),a instanceof Error)throw a;var s=new Error("Unhandled error."+(a?" ("+a.message+")":""));throw s.context=a,s}var c=i[e];if(void 0===c)return!1;if("function"==typeof c)n(c,this,t);else{var l=c.length,u=f(c,l);for(r=0;r<l;++r)n(u[r],this,t)}return!0},i.prototype.addListener=function(e,t){return l(this,e,t,!1)},i.prototype.on=i.prototype.addListener,i.prototype.prependListener=function(e,t){return l(this,e,t,!0)},i.prototype.once=function(e,t){return s(t),this.on(e,p(this,e,t)),this},i.prototype.prependOnceListener=function(e,t){return s(t),this.prependListener(e,p(this,e,t)),this},i.prototype.removeListener=function(e,t){var r,n,o,i,a;if(s(t),void 0===(n=this._events))return this;if(void 0===(r=n[e]))return this;if(r===t||r.listener===t)0==--this._eventsCount?this._events=Object.create(null):(delete n[e],n.removeListener&&this.emit("removeListener",e,r.listener||t));else if("function"!=typeof r){for(o=-1,i=r.length-1;i>=0;i--)if(r[i]===t||r[i].listener===t){a=r[i].listener,o=i;break}if(o<0)return this;0===o?r.shift():function(e,t){for(;t+1<e.length;t++)e[t]=e[t+1];e.pop()}(r,o),1===r.length&&(n[e]=r[0]),void 0!==n.removeListener&&this.emit("removeListener",e,a||t)}return this},i.prototype.off=i.prototype.removeListener,i.prototype.removeAllListeners=function(e){var t,r,n;if(void 0===(r=this._events))return this;if(void 0===r.removeListener)return 0===arguments.length?(this._events=Object.create(null),this._eventsCount=0):void 0!==r[e]&&(0==--this._eventsCount?this._events=Object.create(null):delete r[e]),this;if(0===arguments.length){var o,i=Object.keys(r);for(n=0;n<i.length;++n)"removeListener"!==(o=i[n])&&this.removeAllListeners(o);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if("function"==typeof(t=r[e]))this.removeListener(e,t);else if(void 0!==t)for(n=t.length-1;n>=0;n--)this.removeListener(e,t[n]);return this},i.prototype.listeners=function(e){return d(this,e,!0)},i.prototype.rawListeners=function(e){return d(this,e,!1)},i.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):h.call(e,t)},i.prototype.listenerCount=h,i.prototype.eventNames=function(){return this._eventsCount>0?t(this._events):[]}},880:function(e,t,r){var n,o;!function(){"use strict";n=function(){var e=function(){},t="undefined",r=typeof window!==t&&typeof window.navigator!==t&&/Trident\/|MSIE /.test(window.navigator.userAgent),n=["trace","debug","info","warn","error"],o={},i=null;function a(e,t){var r=e[t];if("function"==typeof r.bind)return r.bind(e);try{return Function.prototype.bind.call(r,e)}catch(t){return function(){return Function.prototype.apply.apply(r,[e,arguments])}}}function s(){console.log&&(console.log.apply?console.log.apply(console,arguments):Function.prototype.apply.apply(console.log,[console,arguments])),console.trace&&console.trace()}function c(){for(var r=this.getLevel(),o=0;o<n.length;o++){var i=n[o];this[i]=o<r?e:this.methodFactory(i,r,this.name)}if(this.log=this.debug,typeof console===t&&r<this.levels.SILENT)return"No console available for logging"}function l(e){return function(){typeof console!==t&&(c.call(this),this[e].apply(this,arguments))}}function u(n,o,i){return function(n){return"debug"===n&&(n="log"),typeof console!==t&&("trace"===n&&r?s:void 0!==console[n]?a(console,n):void 0!==console.log?a(console,"log"):e)}(n)||l.apply(this,arguments)}function p(e,r){var a,s,l,p=this,d="loglevel";function h(){var e;if(typeof window!==t&&d){try{e=window.localStorage[d]}catch(e){}if(typeof e===t)try{var r=window.document.cookie,n=encodeURIComponent(d),o=r.indexOf(n+"=");-1!==o&&(e=/^([^;]+)/.exec(r.slice(o+n.length+1))[1])}catch(e){}return void 0===p.levels[e]&&(e=void 0),e}}function f(e){var t=e;if("string"==typeof t&&void 0!==p.levels[t.toUpperCase()]&&(t=p.levels[t.toUpperCase()]),"number"==typeof t&&t>=0&&t<=p.levels.SILENT)return t;throw new TypeError("log.setLevel() called with invalid level: "+e)}"string"==typeof e?d+=":"+e:"symbol"==typeof e&&(d=void 0),p.name=e,p.levels={TRACE:0,DEBUG:1,INFO:2,WARN:3,ERROR:4,SILENT:5},p.methodFactory=r||u,p.getLevel=function(){return null!=l?l:null!=s?s:a},p.setLevel=function(e,r){return l=f(e),!1!==r&&function(e){var r=(n[e]||"silent").toUpperCase();if(typeof window!==t&&d){try{return void(window.localStorage[d]=r)}catch(e){}try{window.document.cookie=encodeURIComponent(d)+"="+r+";"}catch(e){}}}(l),c.call(p)},p.setDefaultLevel=function(e){s=f(e),h()||p.setLevel(e,!1)},p.resetLevel=function(){l=null,function(){if(typeof window!==t&&d){try{window.localStorage.removeItem(d)}catch(e){}try{window.document.cookie=encodeURIComponent(d)+"=; expires=Thu, 01 Jan 1970 00:00:00 UTC"}catch(e){}}}(),c.call(p)},p.enableAll=function(e){p.setLevel(p.levels.TRACE,e)},p.disableAll=function(e){p.setLevel(p.levels.SILENT,e)},p.rebuild=function(){if(i!==p&&(a=f(i.getLevel())),c.call(p),i===p)for(var e in o)o[e].rebuild()},a=f(i?i.getLevel():"WARN");var m=h();null!=m&&(l=f(m)),c.call(p)}(i=new p).getLogger=function(e){if("symbol"!=typeof e&&"string"!=typeof e||""===e)throw new TypeError("You must supply a name when creating a logger.");var t=o[e];return t||(t=o[e]=new p(e,i.methodFactory)),t};var d=typeof window!==t?window.log:void 0;return i.noConflict=function(){return typeof window!==t&&window.log===i&&(window.log=d),i},i.getLoggers=function(){return o},i.default=i,i},void 0===(o=n.call(t,r,t,e))||(e.exports=o)}()}},t={};function r(n){var o=t[n];if(void 0!==o)return o.exports;var i=t[n]={exports:{}};return e[n].call(i.exports,i,i.exports,r),i.exports}r.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return r.d(t,{a:t}),t},r.d=(e,t)=>{for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var n={};return(()=>{"use strict";function e(t){return e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},e(t)}function t(t,r,n){return(r=function(t){var r=function(t){if("object"!=e(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=e(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==e(r)?r:r+""}(r))in t?Object.defineProperty(t,r,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[r]=n,t}function o(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function i(e){for(var r=1;r<arguments.length;r++){var n=null!=arguments[r]?arguments[r]:{};r%2?o(Object(n),!0).forEach((function(r){t(e,r,n[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):o(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}r.r(n),r.d(n,{ADAPTER_CATEGORY:()=>R,ADAPTER_EVENTS:()=>x,ADAPTER_NAMES:()=>_,ADAPTER_NAMESPACES:()=>C,ADAPTER_STATUS:()=>k,BaseAdapter:()=>j,CHAIN_NAMESPACES:()=>b,EVM_ADAPTERS:()=>L,EVM_PLUGINS:()=>fe,MULTI_CHAIN_ADAPTERS:()=>S,PLUGIN_EVENTS:()=>he,PLUGIN_NAMESPACES:()=>pe,PLUGIN_STATUS:()=>de,PROVIDER_EVENTS:()=>ye,SOLANA_ADAPTERS:()=>P,SOLANA_PLUGINS:()=>me,UX_MODE:()=>u,WALLET_ADAPTERS:()=>I,WALLET_PLUGINS:()=>ge,WEB3AUTH_NETWORK:()=>p,WalletInitializationError:()=>y,WalletLoginError:()=>v,WalletOperationsError:()=>w,WalletProviderError:()=>E,WalletServicesPluginError:()=>ue,Web3AuthError:()=>g,checkIfTokenIsExpired:()=>ie,clearToken:()=>ce,cloneDeep:()=>U,fetchProjectConfig:()=>re,fetchWalletRegistry:()=>ne,getChainConfig:()=>O,getEvmChainConfig:()=>N,getSavedToken:()=>ae,getSolanaChainConfig:()=>A,getXrplChainConfig:()=>T,isHexStrict:()=>ee,log:()=>le,normalizeWalletName:()=>oe,saveToken:()=>se,serializeError:()=>m,signerHost:()=>te,storageAvailable:()=>Z});var a=r(46);function s(e,t,r){try{Reflect.apply(e,t,r)}catch(e){setTimeout((()=>{throw e}))}}class c extends a.EventEmitter{emit(e,...t){let r="error"===e;const n=this._events;if(void 0!==n)r=r&&void 0===n.error;else if(!r)return!1;if(r){let e;if(t.length>0&&([e]=t),e instanceof Error)throw e;const r=new Error("Unhandled error."+(e?` (${e.message})`:""));throw r.context=e,r}const o=n[e];if(void 0===o)return!1;if("function"==typeof o)s(o,this,t);else{const e=o.length,r=function(e){const t=e.length,r=new Array(t);for(let n=0;n<t;n+=1)r[n]=e[n];return r}(o);for(let n=0;n<e;n+=1)s(r[n],this,t)}return!0}}const l={MAINNET:"mainnet",TESTNET:"testnet",CYAN:"cyan",AQUA:"aqua",CELESTE:"celeste"},u={POPUP:"popup",REDIRECT:"redirect"},p=i(i({},{SAPPHIRE_DEVNET:"sapphire_devnet",SAPPHIRE_MAINNET:"sapphire_mainnet"}),l);var d,h=(d=function(e,t){return d=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},d(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}d(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}),f=function(e){function t(t,r){var n,o,i,a=this.constructor,s=e.call(this,t,r)||this;return Object.defineProperty(s,"name",{value:a.name,enumerable:!1,configurable:!0}),n=s,o=a.prototype,(i=Object.setPrototypeOf)?i(n,o):n.__proto__=o,function(e,t){void 0===t&&(t=e.constructor);var r=Error.captureStackTrace;r&&r(e,t)}(s),s}return h(t,e),t}(Error);function m(e){const t=e.findIndex((e=>e instanceof Error)),r=e.findIndex((e=>"string"==typeof e)),n=e.findIndex((e=>e&&"object"==typeof e&&"status"in e&&"type"in e));let o;if(-1!==n){const t=e[n];o=new Error(`${t.status} ${t.type.toString()} ${t.statusText}`)}else o=-1!==t?e.splice(t,1)[0]:-1!==r?new Error(e.splice(r,1)[0]):new Error("Unknown error");return[o,e]}class g extends f{constructor(e,r,n){super(r),t(this,"code",void 0),t(this,"message",void 0),t(this,"cause",void 0),this.code=e,this.message=r||"",this.cause=n,Object.defineProperty(this,"name",{value:"Web3AuthError"})}toJSON(){return{name:this.name,code:this.code,message:this.message,cause:m([this.cause])}}toString(){return JSON.stringify(this.toJSON())}}class y extends g{constructor(e,t,r){super(e,t,r),Object.defineProperty(this,"name",{value:"WalletInitializationError"})}static fromCode(e,t="",r){return new y(e,`${y.messages[e]}, ${t}`,r)}static notFound(e="",t){return y.fromCode(5001,e,t)}static notInstalled(e="",t){return y.fromCode(5002,e,t)}static notReady(e="",t){return y.fromCode(5003,e,t)}static windowBlocked(e="",t){return y.fromCode(5004,e,t)}static windowClosed(e="",t){return y.fromCode(5005,e,t)}static incompatibleChainNameSpace(e="",t){return y.fromCode(5006,e,t)}static duplicateAdapterError(e="",t){return y.fromCode(5007,e,t)}static invalidProviderConfigError(e="",t){return y.fromCode(5008,e,t)}static providerNotReadyError(e="",t){return y.fromCode(5009,e,t)}static rpcConnectionError(e="",t){return y.fromCode(5010,e,t)}static invalidParams(e="",t){return y.fromCode(5011,e,t)}static invalidNetwork(e="",t){return y.fromCode(5013,e,t)}}t(y,"messages",{5e3:"Custom",5001:"Wallet is not found",5002:"Wallet is not installed",5003:"Wallet is not ready yet",5004:"Wallet window is blocked",5005:"Wallet window has been closed by the user",5006:"Incompatible chain namespace provided",5007:"Adapter has already been included",5008:"Invalid provider Config",5009:"Provider is not ready yet",5010:"Failed to connect with rpc url",5011:"Invalid params passed in",5013:"Invalid network provided"});class v extends g{constructor(e,t,r){super(e,t,r),Object.defineProperty(this,"name",{value:"WalletLoginError"})}static fromCode(e,t="",r){return new v(e,`${v.messages[e]}. ${t}`,r)}static connectionError(e="",t){return v.fromCode(5111,e,t)}static disconnectionError(e="",t){return v.fromCode(5112,e,t)}static notConnectedError(e="",t){return v.fromCode(5113,e,t)}static popupClosed(e="",t){return v.fromCode(5114,e,t)}static mfaEnabled(e="",t){return v.fromCode(5115,e,t)}static chainConfigNotAdded(e="",t){return v.fromCode(5116,e,t)}static unsupportedOperation(e="",t){return v.fromCode(5117,e,t)}static coreKitKeyNotFound(e="",t){return v.fromCode(5118,e,t)}static userNotLoggedIn(e="",t){return v.fromCode(5119,e,t)}}t(v,"messages",{5e3:"Custom",5111:"Failed to connect with wallet",5112:"Failed to disconnect from wallet",5113:"Wallet is not connected",5114:"Wallet popup has been closed by the user",5115:"User has already enabled mfa, please use the @web3auth/web3auth-web sdk for login with mfa",5116:"Chain config has not been added. Please add the chain config before calling switchChain",5117:"Unsupported operation",5118:"useCoreKitKey flag is enabled but coreKitKey is not available",5119:"User not logged in."});class w extends g{constructor(e,t,r){super(e,t,r),Object.defineProperty(this,"name",{value:"WalletOperationsError"})}static fromCode(e,t="",r){return new w(e,`${w.messages[e]}, ${t}`,r)}static chainIDNotAllowed(e="",t){return w.fromCode(5201,e,t)}static operationNotAllowed(e="",t){return w.fromCode(5202,e,t)}static chainNamespaceNotAllowed(e="",t){return w.fromCode(5203,e,t)}}t(w,"messages",{5e3:"Custom",5201:"Provided chainId is not allowed",5202:"This operation is not allowed"});class E extends g{constructor(e,t,r){super(e,t,r),Object.defineProperty(this,"name",{value:"WalletProviderError"})}static fromCode(e,t="",r){return new w(e,`${E.messages[e]}, ${t}`,r)}static invalidRequestArgs(e="",t){return w.fromCode(5301,e,t)}static invalidRequestMethod(e="",t){return w.fromCode(5302,e,t)}static invalidRequestParams(e="",t){return w.fromCode(5303,e,t)}}t(E,"messages",{5e3:"Custom",5301:"Expected a single, non-array, object argument.",5302:"'args.method' must be a non-empty string.",5303:"'args.params' must be an object or array if provided."});const b={EIP155:"eip155",SOLANA:"solana",CASPER:"casper",XRPL:"xrpl",OTHER:"other"},C={EIP155:"eip155",SOLANA:"solana",CASPER:"casper",XRPL:"xrpl",MULTICHAIN:"multichain"},N=e=>{const t=b.EIP155;return 1===e?{logo:"https://images.toruswallet.io/eth.svg",chainNamespace:t,chainId:"0x1",rpcTarget:"https://rpc.ankr.com/eth",displayName:"Ethereum Mainnet",blockExplorerUrl:"https://etherscan.io/",ticker:"ETH",tickerName:"Ethereum",decimals:18}:5===e?{logo:"https://images.toruswallet.io/eth.svg",chainNamespace:t,chainId:"0x5",rpcTarget:"https://rpc.ankr.com/eth_goerli",displayName:"Goerli Testnet",blockExplorerUrl:"https://goerli.etherscan.io/",ticker:"ETH",tickerName:"Ethereum",decimals:18}:11155111===e?{logo:"https://images.toruswallet.io/eth.svg",chainNamespace:t,chainId:"0xaa36a7",rpcTarget:"https://rpc.ankr.com/eth_sepolia",displayName:"Sepolia Testnet",blockExplorerUrl:"https://sepolia.etherscan.io/",ticker:"ETH",tickerName:"Ethereum",decimals:18}:137===e?{logo:"https://images.toruswallet.io/polygon.svg",chainNamespace:t,chainId:"0x89",rpcTarget:"https://rpc.ankr.com/polygon",displayName:"Polygon Mainnet",blockExplorerUrl:"https://polygonscan.com",ticker:"MATIC",tickerName:"Polygon"}:80002===e?{logo:"https://images.toruswallet.io/polygon.svg",chainNamespace:t,chainId:"0x13882",rpcTarget:"https://rpc.ankr.com/polygon_amoy",displayName:"Polygon Amoy Testnet",blockExplorerUrl:"https://www.oklink.com/amoy",ticker:"MATIC",tickerName:"Polygon",decimals:18}:56===e?{logo:"https://images.toruswallet.io/bnb.png",chainNamespace:t,chainId:"0x38",rpcTarget:"https://rpc.ankr.com/bsc",displayName:"Binance SmartChain Mainnet",blockExplorerUrl:"https://bscscan.com",ticker:"BNB",tickerName:"Binance SmartChain",decimals:18}:97===e?{logo:"https://images.toruswallet.io/bnb.png",chainNamespace:t,chainId:"0x61",rpcTarget:"https://rpc.ankr.com/bsc_testnet_chapel",displayName:"Binance SmartChain Testnet",blockExplorerUrl:"https://testnet.bscscan.com",ticker:"BNB",tickerName:"Binance SmartChain",decimals:18}:25===e?{logo:"https://images.toruswallet.io/cro.svg",chainNamespace:t,chainId:"0x19",rpcTarget:"https://rpc.cronos.org",displayName:"Cronos Mainnet",blockExplorerUrl:"https://cronoscan.com/",ticker:"CRO",tickerName:"Cronos"}:338===e?{logo:"https://images.toruswallet.io/cro.svg",chainNamespace:t,chainId:"0x152",rpcTarget:"https://rpc-t3.cronos.org/",displayName:"Cronos Testnet",blockExplorerUrl:"https://cronoscan.com/",ticker:"CRO",tickerName:"Cronos",decimals:18}:8217===e?{logo:"https://images.toruswallet.io/klay.svg",chainNamespace:t,chainId:"0x2019",rpcTarget:"https://public-node-api.klaytnapi.com/v1/cypress",displayName:"Klaytn Mainnet",blockExplorerUrl:"https://scope.klaytn.com",ticker:"KLAY",tickerName:"Klaytn",decimals:18}:null},A=e=>{const t=b.SOLANA;return 1===e?{logo:"https://images.toruswallet.io/sol.svg",chainNamespace:t,chainId:"0x1",rpcTarget:"https://rpc.ankr.com/solana",displayName:"Solana Mainnet",blockExplorerUrl:"https://explorer.solana.com",ticker:"SOL",tickerName:"Solana",decimals:9}:2===e?{logo:"https://images.toruswallet.io/sol.svg",chainNamespace:t,chainId:"0x2",rpcTarget:"https://api.testnet.solana.com",displayName:"Solana Testnet",blockExplorerUrl:"https://explorer.solana.com?cluster=testnet",ticker:"SOL",tickerName:"Solana",decimals:9}:3===e?{logo:"https://images.toruswallet.io/sol.svg",chainNamespace:t,chainId:"0x3",rpcTarget:"https://api.devnet.solana.com",displayName:"Solana Devnet",blockExplorerUrl:"https://explorer.solana.com?cluster=devnet",ticker:"SOL",tickerName:"Solana",decimals:9}:null},T=e=>{const t=b.XRPL;return 1===e?{chainNamespace:t,decimals:15,chainId:"0x1",logo:"https://images.toruswallet.io/XRP.svg",rpcTarget:"https://ripple-node.tor.us",wsTarget:"wss://s2.ripple.com",ticker:"XRP",tickerName:"XRPL",displayName:"xrpl mainnet",blockExplorerUrl:"https://livenet.xrpl.org"}:2===e?{chainNamespace:t,decimals:15,chainId:"0x2",logo:"https://images.toruswallet.io/XRP.svg",rpcTarget:"https://testnet-ripple-node.tor.us",wsTarget:"wss://s.altnet.rippletest.net",ticker:"XRP",tickerName:"XRPL",displayName:"xrpl testnet",blockExplorerUrl:"https://testnet.xrpl.org",isTestnet:!0}:3===e?{chainNamespace:t,decimals:15,chainId:"0x3",logo:"https://images.toruswallet.io/XRP.svg",rpcTarget:"https://devnet-ripple-node.tor.us",wsTarget:"wss://s.devnet.rippletest.net/",ticker:"XRP",tickerName:"XRPL",displayName:"xrpl devnet",blockExplorerUrl:"https://devnet.xrpl.org",isTestnet:!0}:null},O=(e,t)=>{if(e===b.OTHER)return null;const r=t?"number"==typeof t?t:parseInt(t,16):(e=>{if(e===b.EIP155)return 1;if(e===b.SOLANA)return 1;if(e===b.XRPL)return 1;throw y.invalidParams(`Chain namespace ${e} is not supported`)})(e);return e===b.EIP155?N(r):e===b.SOLANA?A(r):e===b.XRPL?T(r):null},S={OPENLOGIN:"openlogin",WALLET_CONNECT_V2:"wallet-connect-v2",SFA:"sfa"},P=i({TORUS_SOLANA:"torus-solana",PHANTOM:"phantom",SOLFLARE:"solflare"},S),L=i({TORUS_EVM:"torus-evm",METAMASK:"metamask",COINBASE:"coinbase"},S),I=i(i({},L),P),_={[S.OPENLOGIN]:"OpenLogin",[S.WALLET_CONNECT_V2]:"Wallet Connect v2",[S.SFA]:"SFA",[P.TORUS_SOLANA]:"Torus",[P.PHANTOM]:"Phantom",[P.SOLFLARE]:"Solflare",[L.TORUS_EVM]:"Torus",[L.METAMASK]:"Metamask",[L.COINBASE]:"Coinbase"},R={EXTERNAL:"external",IN_APP:"in_app"},k={NOT_READY:"not_ready",READY:"ready",CONNECTING:"connecting",CONNECTED:"connected",DISCONNECTED:"disconnected",ERRORED:"errored"},x=i(i({},k),{},{ADAPTER_DATA_UPDATED:"adapter_data_updated",CACHE_CLEAR:"cache_clear"});class j extends c{constructor(e={}){super(),t(this,"adapterData",{}),t(this,"sessionTime",86400),t(this,"clientId",void 0),t(this,"web3AuthNetwork",p.MAINNET),t(this,"useCoreKitKey",void 0),t(this,"rehydrated",!1),t(this,"chainConfig",null),t(this,"knownChainConfigs",{}),t(this,"adapterNamespace",void 0),t(this,"currentChainNamespace",void 0),t(this,"type",void 0),t(this,"name",void 0),t(this,"status",void 0),this.setAdapterSettings(e)}get chainConfigProxy(){return this.chainConfig?i({},this.chainConfig):null}get connnected(){return this.status===k.CONNECTED}setAdapterSettings(e){if(this.status===k.READY)return;null!=e&&e.sessionTime&&(this.sessionTime=e.sessionTime),null!=e&&e.clientId&&(this.clientId=e.clientId),null!=e&&e.web3AuthNetwork&&(this.web3AuthNetwork=e.web3AuthNetwork),void 0!==(null==e?void 0:e.useCoreKitKey)&&(this.useCoreKitKey=e.useCoreKitKey);const t=e.chainConfig;if(t){if(!t.chainNamespace)throw y.notReady("ChainNamespace is required while setting chainConfig");this.currentChainNamespace=t.chainNamespace;const e=i(i({},O(t.chainNamespace,t.chainId)||{}),t);this.chainConfig=e,this.addChainConfig(e)}}checkConnectionRequirements(){if(this.name!==I.WALLET_CONNECT_V2||this.status!==k.CONNECTING){if(this.status===k.CONNECTING)throw y.notReady("Already connecting");if(this.status===k.CONNECTED)throw v.connectionError("Already connected");if(this.status!==k.READY)throw v.connectionError("Wallet adapter is not ready yet, Please wait for init function to resolve before calling connect/connectTo function")}}checkInitializationRequirements(){if(!this.clientId)throw y.invalidParams("Please initialize Web3Auth with a valid clientId in constructor");if(!this.chainConfig)throw y.invalidParams("rpcTarget is required in chainConfig");if(!this.chainConfig.rpcTarget&&this.chainConfig.chainNamespace!==b.OTHER)throw y.invalidParams("rpcTarget is required in chainConfig");if(!this.chainConfig.chainId&&this.chainConfig.chainNamespace!==b.OTHER)throw y.invalidParams("chainID is required in chainConfig");if(this.status!==k.NOT_READY){if(this.status===k.CONNECTED)throw y.notReady("Already connected");if(this.status===k.READY)throw y.notReady("Adapter is already initialized")}}checkDisconnectionRequirements(){if(this.status!==k.CONNECTED)throw v.disconnectionError("Not connected with wallet")}checkAddChainRequirements(e,t=!1){if(!t&&!this.provider)throw v.notConnectedError("Not connected with wallet.");if(this.currentChainNamespace!==e.chainNamespace)throw w.chainNamespaceNotAllowed("This adapter doesn't support this chainNamespace")}checkSwitchChainRequirements({chainId:e},t=!1){if(!t&&!this.provider)throw v.notConnectedError("Not connected with wallet.");if(!this.knownChainConfigs[e])throw v.chainConfigNotAdded("Invalid chainId")}updateAdapterData(e){this.adapterData=e,this.emit(x.ADAPTER_DATA_UPDATED,{adapterName:this.name,data:e})}addChainConfig(e){const t=this.knownChainConfigs[e.chainId];this.knownChainConfigs[e.chainId]=i(i({},t||{}),e)}getChainConfig(e){return this.knownChainConfigs[e]||null}}class D extends Error{}function U(e){try{return structuredClone(e)}catch(t){return JSON.parse(JSON.stringify(e,((e,t)=>"bigint"==typeof t?t.toString():t)))}}D.prototype.name="InvalidTokenError";const M="mainnet",W="testnet",$="cyan",F="aqua",K="celeste",H="sapphire_devnet",q="sapphire_mainnet",X={[q]:"https://signer.web3auth.io",[H]:"https://signer.web3auth.io",[M]:"https://signer.web3auth.io",[W]:"https://signer.web3auth.io",[$]:"https://signer-polygon.web3auth.io",[F]:"https://signer-polygon.web3auth.io",[K]:"https://signer-polygon.web3auth.io"};var B=r(743),G=r.n(B),z=r(880),V=r.n(z);const Y=V().getLogger("http-helpers");Y.setLevel(z.levels.INFO);let J="torus-default";const Q=async(e,t={},r={})=>{const n={mode:"cors",headers:{}};r.useAPIKey&&(n.headers=i(i({},n.headers),function(){const e={};return J&&(e["x-api-key"]=J),e}())),t.method="GET";const o=G()(n,t),a=await async function(e,t){let r=null;try{r=new URL(e)}catch(e){}return fetch(e,t)}(e,o);if(a.ok){const e=a.headers.get("content-type");return null!=e&&e.includes("application/json")?a.json():a.text()}throw function(e){Y.info(`Response: ${e.status} ${e.statusText}`),Y.info(`Url: ${e.url}`)}(a),a};function Z(e){let t,r=!1,n=0;try{t=window[e],r=!0,n=t.length;const o="__storage_test__";return t.setItem(o,o),t.removeItem(o),!0}catch(e){const t=e;return!(!t||22!==t.code&&1014!==t.code&&"QuotaExceededError"!==t.name&&"NS_ERROR_DOM_QUOTA_REACHED"!==t.name||!r||0===n)}}const ee=e=>("string"==typeof e||"number"==typeof e)&&/^(-)?0x[0-9a-f]*$/i.test(e),te=e=>X[null!=e?e:p.SAPPHIRE_MAINNET],re=async(e,t)=>{const r=new URL(`${te(t)}/api/configuration`);return r.searchParams.append("project_id",e),r.searchParams.append("network",t),r.searchParams.append("whitelist","true"),await Q(r.href)},ne=async e=>await Q(e||"https://assets.web3auth.io/v1/wallet-registry.json"),oe=e=>{let t=e.toLowerCase();return t=t.split("|")[0],t=t.replace(/-/g," "),t=t.replace(/\s+/g," "),t=t.replace(/wallet$/i,"").trim(),t=t.replace(/\s/g,"-"),t},ie=e=>{const t=function(e,t){if("string"!=typeof e)throw new D("Invalid token specified: must be a string");t||(t={});const r=!0===t.header?0:1,n=e.split(".")[r];if("string"!=typeof n)throw new D(`Invalid token specified: missing part #${r+1}`);let o;try{o=function(e){let t=e.replace(/-/g,"+").replace(/_/g,"/");switch(t.length%4){case 0:break;case 2:t+="==";break;case 3:t+="=";break;default:throw new Error("base64 string is not of the correct length")}try{return function(e){return decodeURIComponent(atob(e).replace(/(.)/g,((e,t)=>{let r=t.charCodeAt(0).toString(16).toUpperCase();return r.length<2&&(r="0"+r),"%"+r})))}(t)}catch(e){return atob(t)}}(n)}catch(e){throw new D(`Invalid token specified: invalid base64 for part #${r+1} (${e.message})`)}try{return JSON.parse(o)}catch(e){throw new D(`Invalid token specified: invalid json for part #${r+1} (${e.message})`)}}(e);return!t.exp||t.exp<Math.floor(Date.now()/1e3)},ae=(e,t)=>Z("localStorage")?localStorage.getItem(`${e.toLowerCase()}_${t}`):null,se=(e,t,r)=>Z("localStorage")?localStorage.setItem(`${e.toLowerCase()}_${t}`,r):null,ce=(e,t)=>Z("localStorage")?localStorage.removeItem(`${e.toLowerCase()}_${t}`):null,le=V().getLogger("web3auth-logger");class ue extends g{constructor(e,t,r){super(e,t,r),Object.defineProperty(this,"name",{value:"WalletServicesPluginError"})}static fromCode(e,t="",r){return new ue(e,`${ue.messages[e]}${t}`,r)}static notInitialized(e="",t){return ue.fromCode(5210,e,t)}static unsupportedAdapter(e="",t){return ue.fromCode(5211,e,t)}static providerRequired(e="",t){return ue.fromCode(5212,e,t)}static web3authRequired(e="",t){return ue.fromCode(5213,e,t)}static web3AuthNotConnected(e="",t){return ue.fromCode(5214,e,t)}static alreadyInitialized(e="",t){return ue.fromCode(5216,e,t)}static unsupportedChainNamespace(e="",t){return ue.fromCode(5218,e,t)}static differentWeb3AuthNetwork(e="",t){return ue.fromCode(5219,e,t)}static invalidParams(e="",t){return ue.fromCode(5220,e,t)}static web3authNotInitialized(e="",t){return ue.fromCode(5221,e,t)}static invalidSession(e="",t){return ue.fromCode(5222,e,t)}static walletPluginNotConnected(e="",t){return ue.fromCode(5223,e,t)}}t(ue,"messages",{5210:"Wallet Services Plugin is not initialized",5211:"Web3Auth is connected to unsupported adapter. Wallet services connector plugin requires web3auth connected to openlogin adapter.",5212:"Provider is required..",5213:"Web3Auth instance is required while initialization.",5214:"Web3Auth is not connected.",5216:"Plugin is already initialized",5218:"Unsupported chain namespace.",5219:"Plugin network different than web3auth instance network.",5221:"Web3Auth is not initialized",5222:"Invalid session inside wallet services. Please report this issue.",5223:"Wallet plugin is not connected Yet. Please wait for plugin to connect and listen via `connected` event on the plugin"});const pe=i(i({},b),{},{MULTICHAIN:"multichain"}),de={READY:"ready",CONNECTING:"connecting",CONNECTED:"connected",DISCONNECTED:"disconnected",ERRORED:"errored"},he=i({},de),fe={WALLET_SERVICES:"wallet-services"},me={SOLANA:"solana"},ge=i(i({},fe),me),ye={INITIALIZED:"initialized",ERRORED:"errored"}})(),n})()));
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.Base=t():e.Base=t()}(self,(()=>(()=>{var e={743:e=>{"use strict";var t=function(e){return function(e){return!!e&&"object"==typeof e}(e)&&!function(e){var t=Object.prototype.toString.call(e);return"[object RegExp]"===t||"[object Date]"===t||function(e){return e.$$typeof===r}(e)}(e)},r="function"==typeof Symbol&&Symbol.for?Symbol.for("react.element"):60103;function n(e,t){return!1!==t.clone&&t.isMergeableObject(e)?s((r=e,Array.isArray(r)?[]:{}),e,t):e;var r}function o(e,t,r){return e.concat(t).map((function(e){return n(e,r)}))}function i(e){return Object.keys(e).concat(function(e){return Object.getOwnPropertySymbols?Object.getOwnPropertySymbols(e).filter((function(t){return Object.propertyIsEnumerable.call(e,t)})):[]}(e))}function a(e,t){try{return t in e}catch(e){return!1}}function s(e,r,c){(c=c||{}).arrayMerge=c.arrayMerge||o,c.isMergeableObject=c.isMergeableObject||t,c.cloneUnlessOtherwiseSpecified=n;var l=Array.isArray(r);return l===Array.isArray(e)?l?c.arrayMerge(e,r,c):function(e,t,r){var o={};return r.isMergeableObject(e)&&i(e).forEach((function(t){o[t]=n(e[t],r)})),i(t).forEach((function(i){(function(e,t){return a(e,t)&&!(Object.hasOwnProperty.call(e,t)&&Object.propertyIsEnumerable.call(e,t))})(e,i)||(a(e,i)&&r.isMergeableObject(t[i])?o[i]=function(e,t){if(!t.customMerge)return s;var r=t.customMerge(e);return"function"==typeof r?r:s}(i,r)(e[i],t[i],r):o[i]=n(t[i],r))})),o}(e,r,c):n(r,c)}s.all=function(e,t){if(!Array.isArray(e))throw new Error("first argument should be an array");return e.reduce((function(e,r){return s(e,r,t)}),{})};var c=s;e.exports=c},46:e=>{"use strict";var t,r="object"==typeof Reflect?Reflect:null,n=r&&"function"==typeof r.apply?r.apply:function(e,t,r){return Function.prototype.apply.call(e,t,r)};t=r&&"function"==typeof r.ownKeys?r.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.getOwnPropertyNames(e)};var o=Number.isNaN||function(e){return e!=e};function i(){i.init.call(this)}e.exports=i,e.exports.once=function(e,t){return new Promise((function(r,n){function o(r){e.removeListener(t,i),n(r)}function i(){"function"==typeof e.removeListener&&e.removeListener("error",o),r([].slice.call(arguments))}m(e,t,i,{once:!0}),"error"!==t&&function(e,t){"function"==typeof e.on&&m(e,"error",t,{once:!0})}(e,o)}))},i.EventEmitter=i,i.prototype._events=void 0,i.prototype._eventsCount=0,i.prototype._maxListeners=void 0;var a=10;function s(e){if("function"!=typeof e)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof e)}function c(e){return void 0===e._maxListeners?i.defaultMaxListeners:e._maxListeners}function l(e,t,r,n){var o,i,a,l;if(s(r),void 0===(i=e._events)?(i=e._events=Object.create(null),e._eventsCount=0):(void 0!==i.newListener&&(e.emit("newListener",t,r.listener?r.listener:r),i=e._events),a=i[t]),void 0===a)a=i[t]=r,++e._eventsCount;else if("function"==typeof a?a=i[t]=n?[r,a]:[a,r]:n?a.unshift(r):a.push(r),(o=c(e))>0&&a.length>o&&!a.warned){a.warned=!0;var u=new Error("Possible EventEmitter memory leak detected. "+a.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");u.name="MaxListenersExceededWarning",u.emitter=e,u.type=t,u.count=a.length,l=u,console&&console.warn&&console.warn(l)}return e}function u(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function p(e,t,r){var n={fired:!1,wrapFn:void 0,target:e,type:t,listener:r},o=u.bind(n);return o.listener=r,n.wrapFn=o,o}function d(e,t,r){var n=e._events;if(void 0===n)return[];var o=n[t];return void 0===o?[]:"function"==typeof o?r?[o.listener||o]:[o]:r?function(e){for(var t=new Array(e.length),r=0;r<t.length;++r)t[r]=e[r].listener||e[r];return t}(o):f(o,o.length)}function h(e){var t=this._events;if(void 0!==t){var r=t[e];if("function"==typeof r)return 1;if(void 0!==r)return r.length}return 0}function f(e,t){for(var r=new Array(t),n=0;n<t;++n)r[n]=e[n];return r}function m(e,t,r,n){if("function"==typeof e.on)n.once?e.once(t,r):e.on(t,r);else{if("function"!=typeof e.addEventListener)throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof e);e.addEventListener(t,(function o(i){n.once&&e.removeEventListener(t,o),r(i)}))}}Object.defineProperty(i,"defaultMaxListeners",{enumerable:!0,get:function(){return a},set:function(e){if("number"!=typeof e||e<0||o(e))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+e+".");a=e}}),i.init=function(){void 0!==this._events&&this._events!==Object.getPrototypeOf(this)._events||(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},i.prototype.setMaxListeners=function(e){if("number"!=typeof e||e<0||o(e))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+e+".");return this._maxListeners=e,this},i.prototype.getMaxListeners=function(){return c(this)},i.prototype.emit=function(e){for(var t=[],r=1;r<arguments.length;r++)t.push(arguments[r]);var o="error"===e,i=this._events;if(void 0!==i)o=o&&void 0===i.error;else if(!o)return!1;if(o){var a;if(t.length>0&&(a=t[0]),a instanceof Error)throw a;var s=new Error("Unhandled error."+(a?" ("+a.message+")":""));throw s.context=a,s}var c=i[e];if(void 0===c)return!1;if("function"==typeof c)n(c,this,t);else{var l=c.length,u=f(c,l);for(r=0;r<l;++r)n(u[r],this,t)}return!0},i.prototype.addListener=function(e,t){return l(this,e,t,!1)},i.prototype.on=i.prototype.addListener,i.prototype.prependListener=function(e,t){return l(this,e,t,!0)},i.prototype.once=function(e,t){return s(t),this.on(e,p(this,e,t)),this},i.prototype.prependOnceListener=function(e,t){return s(t),this.prependListener(e,p(this,e,t)),this},i.prototype.removeListener=function(e,t){var r,n,o,i,a;if(s(t),void 0===(n=this._events))return this;if(void 0===(r=n[e]))return this;if(r===t||r.listener===t)0==--this._eventsCount?this._events=Object.create(null):(delete n[e],n.removeListener&&this.emit("removeListener",e,r.listener||t));else if("function"!=typeof r){for(o=-1,i=r.length-1;i>=0;i--)if(r[i]===t||r[i].listener===t){a=r[i].listener,o=i;break}if(o<0)return this;0===o?r.shift():function(e,t){for(;t+1<e.length;t++)e[t]=e[t+1];e.pop()}(r,o),1===r.length&&(n[e]=r[0]),void 0!==n.removeListener&&this.emit("removeListener",e,a||t)}return this},i.prototype.off=i.prototype.removeListener,i.prototype.removeAllListeners=function(e){var t,r,n;if(void 0===(r=this._events))return this;if(void 0===r.removeListener)return 0===arguments.length?(this._events=Object.create(null),this._eventsCount=0):void 0!==r[e]&&(0==--this._eventsCount?this._events=Object.create(null):delete r[e]),this;if(0===arguments.length){var o,i=Object.keys(r);for(n=0;n<i.length;++n)"removeListener"!==(o=i[n])&&this.removeAllListeners(o);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if("function"==typeof(t=r[e]))this.removeListener(e,t);else if(void 0!==t)for(n=t.length-1;n>=0;n--)this.removeListener(e,t[n]);return this},i.prototype.listeners=function(e){return d(this,e,!0)},i.prototype.rawListeners=function(e){return d(this,e,!1)},i.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):h.call(e,t)},i.prototype.listenerCount=h,i.prototype.eventNames=function(){return this._eventsCount>0?t(this._events):[]}},880:function(e,t,r){var n,o;!function(){"use strict";n=function(){var e=function(){},t="undefined",r=typeof window!==t&&typeof window.navigator!==t&&/Trident\/|MSIE /.test(window.navigator.userAgent),n=["trace","debug","info","warn","error"],o={},i=null;function a(e,t){var r=e[t];if("function"==typeof r.bind)return r.bind(e);try{return Function.prototype.bind.call(r,e)}catch(t){return function(){return Function.prototype.apply.apply(r,[e,arguments])}}}function s(){console.log&&(console.log.apply?console.log.apply(console,arguments):Function.prototype.apply.apply(console.log,[console,arguments])),console.trace&&console.trace()}function c(){for(var r=this.getLevel(),o=0;o<n.length;o++){var i=n[o];this[i]=o<r?e:this.methodFactory(i,r,this.name)}if(this.log=this.debug,typeof console===t&&r<this.levels.SILENT)return"No console available for logging"}function l(e){return function(){typeof console!==t&&(c.call(this),this[e].apply(this,arguments))}}function u(n,o,i){return function(n){return"debug"===n&&(n="log"),typeof console!==t&&("trace"===n&&r?s:void 0!==console[n]?a(console,n):void 0!==console.log?a(console,"log"):e)}(n)||l.apply(this,arguments)}function p(e,r){var a,s,l,p=this,d="loglevel";function h(){var e;if(typeof window!==t&&d){try{e=window.localStorage[d]}catch(e){}if(typeof e===t)try{var r=window.document.cookie,n=encodeURIComponent(d),o=r.indexOf(n+"=");-1!==o&&(e=/^([^;]+)/.exec(r.slice(o+n.length+1))[1])}catch(e){}return void 0===p.levels[e]&&(e=void 0),e}}function f(e){var t=e;if("string"==typeof t&&void 0!==p.levels[t.toUpperCase()]&&(t=p.levels[t.toUpperCase()]),"number"==typeof t&&t>=0&&t<=p.levels.SILENT)return t;throw new TypeError("log.setLevel() called with invalid level: "+e)}"string"==typeof e?d+=":"+e:"symbol"==typeof e&&(d=void 0),p.name=e,p.levels={TRACE:0,DEBUG:1,INFO:2,WARN:3,ERROR:4,SILENT:5},p.methodFactory=r||u,p.getLevel=function(){return null!=l?l:null!=s?s:a},p.setLevel=function(e,r){return l=f(e),!1!==r&&function(e){var r=(n[e]||"silent").toUpperCase();if(typeof window!==t&&d){try{return void(window.localStorage[d]=r)}catch(e){}try{window.document.cookie=encodeURIComponent(d)+"="+r+";"}catch(e){}}}(l),c.call(p)},p.setDefaultLevel=function(e){s=f(e),h()||p.setLevel(e,!1)},p.resetLevel=function(){l=null,function(){if(typeof window!==t&&d){try{window.localStorage.removeItem(d)}catch(e){}try{window.document.cookie=encodeURIComponent(d)+"=; expires=Thu, 01 Jan 1970 00:00:00 UTC"}catch(e){}}}(),c.call(p)},p.enableAll=function(e){p.setLevel(p.levels.TRACE,e)},p.disableAll=function(e){p.setLevel(p.levels.SILENT,e)},p.rebuild=function(){if(i!==p&&(a=f(i.getLevel())),c.call(p),i===p)for(var e in o)o[e].rebuild()},a=f(i?i.getLevel():"WARN");var m=h();null!=m&&(l=f(m)),c.call(p)}(i=new p).getLogger=function(e){if("symbol"!=typeof e&&"string"!=typeof e||""===e)throw new TypeError("You must supply a name when creating a logger.");var t=o[e];return t||(t=o[e]=new p(e,i.methodFactory)),t};var d=typeof window!==t?window.log:void 0;return i.noConflict=function(){return typeof window!==t&&window.log===i&&(window.log=d),i},i.getLoggers=function(){return o},i.default=i,i},void 0===(o=n.call(t,r,t,e))||(e.exports=o)}()}},t={};function r(n){var o=t[n];if(void 0!==o)return o.exports;var i=t[n]={exports:{}};return e[n].call(i.exports,i,i.exports,r),i.exports}r.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return r.d(t,{a:t}),t},r.d=(e,t)=>{for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var n={};return(()=>{"use strict";function e(t){return e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},e(t)}function t(t,r,n){return(r=function(t){var r=function(t){if("object"!=e(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=e(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==e(r)?r:r+""}(r))in t?Object.defineProperty(t,r,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[r]=n,t}function o(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function i(e){for(var r=1;r<arguments.length;r++){var n=null!=arguments[r]?arguments[r]:{};r%2?o(Object(n),!0).forEach((function(r){t(e,r,n[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):o(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}r.r(n),r.d(n,{ADAPTER_CATEGORY:()=>j,ADAPTER_EVENTS:()=>D,ADAPTER_NAMES:()=>x,ADAPTER_NAMESPACES:()=>T,ADAPTER_STATUS:()=>U,BaseAdapter:()=>M,CHAIN_NAMESPACES:()=>A,EVM_ADAPTERS:()=>R,EVM_PLUGINS:()=>le,MULTI_CHAIN_ADAPTERS:()=>_,PLUGIN_EVENTS:()=>ce,PLUGIN_NAMESPACES:()=>ae,PLUGIN_STATUS:()=>se,PROVIDER_EVENTS:()=>de,SOLANA_ADAPTERS:()=>L,SOLANA_PLUGINS:()=>ue,UX_MODE:()=>u,WALLET_ADAPTERS:()=>k,WALLET_PLUGINS:()=>pe,WEB3AUTH_NETWORK:()=>p,WalletInitializationError:()=>E,WalletLoginError:()=>C,WalletOperationsError:()=>b,WalletProviderError:()=>N,WalletServicesPluginError:()=>ie,Web3AuthError:()=>w,checkIfTokenIsExpired:()=>ee,clearToken:()=>ne,cloneDeep:()=>$,fetchProjectConfig:()=>J,fetchWalletRegistry:()=>Q,getChainConfig:()=>I,getEvmChainConfig:()=>O,getSavedToken:()=>te,getSolanaChainConfig:()=>S,getXrplChainConfig:()=>P,isHexStrict:()=>V,log:()=>oe,normalizeWalletName:()=>Z,saveToken:()=>re,serializeError:()=>v,signerHost:()=>Y,storageAvailable:()=>G});const a={MAINNET:"mainnet",TESTNET:"testnet",CYAN:"cyan",AQUA:"aqua",CELESTE:"celeste"},s={SAPPHIRE_DEVNET:"sapphire_devnet",SAPPHIRE_MAINNET:"sapphire_mainnet"},c={[s.SAPPHIRE_MAINNET]:"https://signer.web3auth.io",[s.SAPPHIRE_DEVNET]:"https://signer.web3auth.io",[a.MAINNET]:"https://signer.web3auth.io",[a.TESTNET]:"https://signer.web3auth.io",[a.CYAN]:"https://signer-polygon.web3auth.io",[a.AQUA]:"https://signer-polygon.web3auth.io",[a.CELESTE]:"https://signer-polygon.web3auth.io"},l=a,u={POPUP:"popup",REDIRECT:"redirect"},p=i(i({},s),l);var d=r(46);function h(e,t,r){try{Reflect.apply(e,t,r)}catch(e){setTimeout((()=>{throw e}))}}class f extends d.EventEmitter{emit(e,...t){let r="error"===e;const n=this._events;if(void 0!==n)r=r&&void 0===n.error;else if(!r)return!1;if(r){let e;if(t.length>0&&([e]=t),e instanceof Error)throw e;const r=new Error("Unhandled error."+(e?` (${e.message})`:""));throw r.context=e,r}const o=n[e];if(void 0===o)return!1;if("function"==typeof o)h(o,this,t);else{const e=o.length,r=function(e){const t=e.length,r=new Array(t);for(let n=0;n<t;n+=1)r[n]=e[n];return r}(o);for(let n=0;n<e;n+=1)h(r[n],this,t)}return!0}}var m,g=(m=function(e,t){return m=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},m(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}m(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}),y=function(e){function t(t,r){var n,o,i,a=this.constructor,s=e.call(this,t,r)||this;return Object.defineProperty(s,"name",{value:a.name,enumerable:!1,configurable:!0}),n=s,o=a.prototype,(i=Object.setPrototypeOf)?i(n,o):n.__proto__=o,function(e,t){void 0===t&&(t=e.constructor);var r=Error.captureStackTrace;r&&r(e,t)}(s),s}return g(t,e),t}(Error);function v(e){const t=e.findIndex((e=>e instanceof Error)),r=e.findIndex((e=>"string"==typeof e)),n=e.findIndex((e=>e&&"object"==typeof e&&"status"in e&&"type"in e));let o;if(-1!==n){const t=e[n];o=new Error(`${t.status} ${t.type.toString()} ${t.statusText}`)}else o=-1!==t?e.splice(t,1)[0]:-1!==r?new Error(e.splice(r,1)[0]):new Error("Unknown error");return[o,e]}class w extends y{constructor(e,r,n){super(r),t(this,"code",void 0),t(this,"message",void 0),t(this,"cause",void 0),this.code=e,this.message=r||"",this.cause=n,Object.defineProperty(this,"name",{value:"Web3AuthError"})}toJSON(){return{name:this.name,code:this.code,message:this.message,cause:v([this.cause])}}toString(){return JSON.stringify(this.toJSON())}}class E extends w{constructor(e,t,r){super(e,t,r),Object.defineProperty(this,"name",{value:"WalletInitializationError"})}static fromCode(e,t="",r){return new E(e,`${E.messages[e]}, ${t}`,r)}static notFound(e="",t){return E.fromCode(5001,e,t)}static notInstalled(e="",t){return E.fromCode(5002,e,t)}static notReady(e="",t){return E.fromCode(5003,e,t)}static windowBlocked(e="",t){return E.fromCode(5004,e,t)}static windowClosed(e="",t){return E.fromCode(5005,e,t)}static incompatibleChainNameSpace(e="",t){return E.fromCode(5006,e,t)}static duplicateAdapterError(e="",t){return E.fromCode(5007,e,t)}static invalidProviderConfigError(e="",t){return E.fromCode(5008,e,t)}static providerNotReadyError(e="",t){return E.fromCode(5009,e,t)}static rpcConnectionError(e="",t){return E.fromCode(5010,e,t)}static invalidParams(e="",t){return E.fromCode(5011,e,t)}static invalidNetwork(e="",t){return E.fromCode(5013,e,t)}}t(E,"messages",{5e3:"Custom",5001:"Wallet is not found",5002:"Wallet is not installed",5003:"Wallet is not ready yet",5004:"Wallet window is blocked",5005:"Wallet window has been closed by the user",5006:"Incompatible chain namespace provided",5007:"Adapter has already been included",5008:"Invalid provider Config",5009:"Provider is not ready yet",5010:"Failed to connect with rpc url",5011:"Invalid params passed in",5013:"Invalid network provided"});class C extends w{constructor(e,t,r){super(e,t,r),Object.defineProperty(this,"name",{value:"WalletLoginError"})}static fromCode(e,t="",r){return new C(e,`${C.messages[e]}. ${t}`,r)}static connectionError(e="",t){return C.fromCode(5111,e,t)}static disconnectionError(e="",t){return C.fromCode(5112,e,t)}static notConnectedError(e="",t){return C.fromCode(5113,e,t)}static popupClosed(e="",t){return C.fromCode(5114,e,t)}static mfaEnabled(e="",t){return C.fromCode(5115,e,t)}static chainConfigNotAdded(e="",t){return C.fromCode(5116,e,t)}static unsupportedOperation(e="",t){return C.fromCode(5117,e,t)}static coreKitKeyNotFound(e="",t){return C.fromCode(5118,e,t)}static userNotLoggedIn(e="",t){return C.fromCode(5119,e,t)}}t(C,"messages",{5e3:"Custom",5111:"Failed to connect with wallet",5112:"Failed to disconnect from wallet",5113:"Wallet is not connected",5114:"Wallet popup has been closed by the user",5115:"User has already enabled mfa, please use the @web3auth/web3auth-web sdk for login with mfa",5116:"Chain config has not been added. Please add the chain config before calling switchChain",5117:"Unsupported operation",5118:"useCoreKitKey flag is enabled but coreKitKey is not available",5119:"User not logged in."});class b extends w{constructor(e,t,r){super(e,t,r),Object.defineProperty(this,"name",{value:"WalletOperationsError"})}static fromCode(e,t="",r){return new b(e,`${b.messages[e]}, ${t}`,r)}static chainIDNotAllowed(e="",t){return b.fromCode(5201,e,t)}static operationNotAllowed(e="",t){return b.fromCode(5202,e,t)}static chainNamespaceNotAllowed(e="",t){return b.fromCode(5203,e,t)}}t(b,"messages",{5e3:"Custom",5201:"Provided chainId is not allowed",5202:"This operation is not allowed"});class N extends w{constructor(e,t,r){super(e,t,r),Object.defineProperty(this,"name",{value:"WalletProviderError"})}static fromCode(e,t="",r){return new b(e,`${N.messages[e]}, ${t}`,r)}static invalidRequestArgs(e="",t){return b.fromCode(5301,e,t)}static invalidRequestMethod(e="",t){return b.fromCode(5302,e,t)}static invalidRequestParams(e="",t){return b.fromCode(5303,e,t)}}t(N,"messages",{5e3:"Custom",5301:"Expected a single, non-array, object argument.",5302:"'args.method' must be a non-empty string.",5303:"'args.params' must be an object or array if provided."});const A={EIP155:"eip155",SOLANA:"solana",CASPER:"casper",XRPL:"xrpl",OTHER:"other"},T={EIP155:"eip155",SOLANA:"solana",CASPER:"casper",XRPL:"xrpl",MULTICHAIN:"multichain"},O=e=>{const t=A.EIP155;return 1===e?{logo:"https://images.toruswallet.io/eth.svg",chainNamespace:t,chainId:"0x1",rpcTarget:"https://rpc.ankr.com/eth",displayName:"Ethereum Mainnet",blockExplorerUrl:"https://etherscan.io/",ticker:"ETH",tickerName:"Ethereum",decimals:18}:5===e?{logo:"https://images.toruswallet.io/eth.svg",chainNamespace:t,chainId:"0x5",rpcTarget:"https://rpc.ankr.com/eth_goerli",displayName:"Goerli Testnet",blockExplorerUrl:"https://goerli.etherscan.io/",ticker:"ETH",tickerName:"Ethereum",decimals:18}:11155111===e?{logo:"https://images.toruswallet.io/eth.svg",chainNamespace:t,chainId:"0xaa36a7",rpcTarget:"https://rpc.ankr.com/eth_sepolia",displayName:"Sepolia Testnet",blockExplorerUrl:"https://sepolia.etherscan.io/",ticker:"ETH",tickerName:"Ethereum",decimals:18}:137===e?{logo:"https://images.toruswallet.io/polygon.svg",chainNamespace:t,chainId:"0x89",rpcTarget:"https://rpc.ankr.com/polygon",displayName:"Polygon Mainnet",blockExplorerUrl:"https://polygonscan.com",ticker:"MATIC",tickerName:"Polygon"}:80002===e?{logo:"https://images.toruswallet.io/polygon.svg",chainNamespace:t,chainId:"0x13882",rpcTarget:"https://rpc.ankr.com/polygon_amoy",displayName:"Polygon Amoy Testnet",blockExplorerUrl:"https://www.oklink.com/amoy",ticker:"MATIC",tickerName:"Polygon",decimals:18}:56===e?{logo:"https://images.toruswallet.io/bnb.png",chainNamespace:t,chainId:"0x38",rpcTarget:"https://rpc.ankr.com/bsc",displayName:"Binance SmartChain Mainnet",blockExplorerUrl:"https://bscscan.com",ticker:"BNB",tickerName:"Binance SmartChain",decimals:18}:97===e?{logo:"https://images.toruswallet.io/bnb.png",chainNamespace:t,chainId:"0x61",rpcTarget:"https://rpc.ankr.com/bsc_testnet_chapel",displayName:"Binance SmartChain Testnet",blockExplorerUrl:"https://testnet.bscscan.com",ticker:"BNB",tickerName:"Binance SmartChain",decimals:18}:25===e?{logo:"https://images.toruswallet.io/cro.svg",chainNamespace:t,chainId:"0x19",rpcTarget:"https://rpc.cronos.org",displayName:"Cronos Mainnet",blockExplorerUrl:"https://cronoscan.com/",ticker:"CRO",tickerName:"Cronos"}:338===e?{logo:"https://images.toruswallet.io/cro.svg",chainNamespace:t,chainId:"0x152",rpcTarget:"https://rpc-t3.cronos.org/",displayName:"Cronos Testnet",blockExplorerUrl:"https://cronoscan.com/",ticker:"CRO",tickerName:"Cronos",decimals:18}:8217===e?{logo:"https://images.toruswallet.io/klay.svg",chainNamespace:t,chainId:"0x2019",rpcTarget:"https://public-node-api.klaytnapi.com/v1/cypress",displayName:"Klaytn Mainnet",blockExplorerUrl:"https://scope.klaytn.com",ticker:"KLAY",tickerName:"Klaytn",decimals:18}:null},S=e=>{const t=A.SOLANA;return 1===e?{logo:"https://images.toruswallet.io/sol.svg",chainNamespace:t,chainId:"0x1",rpcTarget:"https://rpc.ankr.com/solana",displayName:"Solana Mainnet",blockExplorerUrl:"https://explorer.solana.com",ticker:"SOL",tickerName:"Solana",decimals:9}:2===e?{logo:"https://images.toruswallet.io/sol.svg",chainNamespace:t,chainId:"0x2",rpcTarget:"https://api.testnet.solana.com",displayName:"Solana Testnet",blockExplorerUrl:"https://explorer.solana.com?cluster=testnet",ticker:"SOL",tickerName:"Solana",decimals:9}:3===e?{logo:"https://images.toruswallet.io/sol.svg",chainNamespace:t,chainId:"0x3",rpcTarget:"https://api.devnet.solana.com",displayName:"Solana Devnet",blockExplorerUrl:"https://explorer.solana.com?cluster=devnet",ticker:"SOL",tickerName:"Solana",decimals:9}:null},P=e=>{const t=A.XRPL;return 1===e?{chainNamespace:t,decimals:15,chainId:"0x1",logo:"https://images.toruswallet.io/XRP.svg",rpcTarget:"https://ripple-node.tor.us",wsTarget:"wss://s2.ripple.com",ticker:"XRP",tickerName:"XRPL",displayName:"xrpl mainnet",blockExplorerUrl:"https://livenet.xrpl.org"}:2===e?{chainNamespace:t,decimals:15,chainId:"0x2",logo:"https://images.toruswallet.io/XRP.svg",rpcTarget:"https://testnet-ripple-node.tor.us",wsTarget:"wss://s.altnet.rippletest.net",ticker:"XRP",tickerName:"XRPL",displayName:"xrpl testnet",blockExplorerUrl:"https://testnet.xrpl.org",isTestnet:!0}:3===e?{chainNamespace:t,decimals:15,chainId:"0x3",logo:"https://images.toruswallet.io/XRP.svg",rpcTarget:"https://devnet-ripple-node.tor.us",wsTarget:"wss://s.devnet.rippletest.net/",ticker:"XRP",tickerName:"XRPL",displayName:"xrpl devnet",blockExplorerUrl:"https://devnet.xrpl.org",isTestnet:!0}:null},I=(e,t)=>{if(e===A.OTHER)return null;const r=t?"number"==typeof t?t:parseInt(t,16):(e=>{if(e===A.EIP155)return 1;if(e===A.SOLANA)return 1;if(e===A.XRPL)return 1;throw E.invalidParams(`Chain namespace ${e} is not supported`)})(e);return e===A.EIP155?O(r):e===A.SOLANA?S(r):e===A.XRPL?P(r):null},_={AUTH:"auth",WALLET_CONNECT_V2:"wallet-connect-v2",SFA:"sfa"},L=i({TORUS_SOLANA:"torus-solana"},_),R=i({TORUS_EVM:"torus-evm",COINBASE:"coinbase"},_),k=i(i({},R),L),x={[_.AUTH]:"Auth",[_.WALLET_CONNECT_V2]:"Wallet Connect v2",[_.SFA]:"SFA",[L.TORUS_SOLANA]:"Torus",[R.TORUS_EVM]:"Torus",[R.COINBASE]:"Coinbase"},j={EXTERNAL:"external",IN_APP:"in_app"},U={NOT_READY:"not_ready",READY:"ready",CONNECTING:"connecting",CONNECTED:"connected",DISCONNECTED:"disconnected",ERRORED:"errored"},D=i(i({},U),{},{ADAPTER_DATA_UPDATED:"adapter_data_updated",CACHE_CLEAR:"cache_clear"});class M extends f{constructor(e={}){super(),t(this,"adapterData",{}),t(this,"sessionTime",86400),t(this,"clientId",void 0),t(this,"web3AuthNetwork",p.MAINNET),t(this,"useCoreKitKey",void 0),t(this,"rehydrated",!1),t(this,"chainConfig",null),t(this,"knownChainConfigs",{}),t(this,"adapterNamespace",void 0),t(this,"currentChainNamespace",void 0),t(this,"type",void 0),t(this,"name",void 0),t(this,"status",void 0),this.setAdapterSettings(e)}get chainConfigProxy(){return this.chainConfig?i({},this.chainConfig):null}get connnected(){return this.status===U.CONNECTED}setAdapterSettings(e){if(this.status===U.READY)return;null!=e&&e.sessionTime&&(this.sessionTime=e.sessionTime),null!=e&&e.clientId&&(this.clientId=e.clientId),null!=e&&e.web3AuthNetwork&&(this.web3AuthNetwork=e.web3AuthNetwork),void 0!==(null==e?void 0:e.useCoreKitKey)&&(this.useCoreKitKey=e.useCoreKitKey);const t=e.chainConfig;if(t){if(!t.chainNamespace)throw E.notReady("ChainNamespace is required while setting chainConfig");this.currentChainNamespace=t.chainNamespace;const e=i(i({},I(t.chainNamespace,t.chainId)||{}),t);this.chainConfig=e,this.addChainConfig(e)}}checkConnectionRequirements(){if(this.name!==k.WALLET_CONNECT_V2||this.status!==U.CONNECTING){if(this.status===U.CONNECTING)throw E.notReady("Already connecting");if(this.status===U.CONNECTED)throw C.connectionError("Already connected");if(this.status!==U.READY)throw C.connectionError("Wallet adapter is not ready yet, Please wait for init function to resolve before calling connect/connectTo function")}}checkInitializationRequirements(){if(!this.clientId)throw E.invalidParams("Please initialize Web3Auth with a valid clientId in constructor");if(!this.chainConfig)throw E.invalidParams("rpcTarget is required in chainConfig");if(!this.chainConfig.rpcTarget&&this.chainConfig.chainNamespace!==A.OTHER)throw E.invalidParams("rpcTarget is required in chainConfig");if(!this.chainConfig.chainId&&this.chainConfig.chainNamespace!==A.OTHER)throw E.invalidParams("chainID is required in chainConfig");if(this.status!==U.NOT_READY){if(this.status===U.CONNECTED)throw E.notReady("Already connected");if(this.status===U.READY)throw E.notReady("Adapter is already initialized")}}checkDisconnectionRequirements(){if(this.status!==U.CONNECTED)throw C.disconnectionError("Not connected with wallet")}checkAddChainRequirements(e,t=!1){if(!t&&!this.provider)throw C.notConnectedError("Not connected with wallet.");if(this.currentChainNamespace!==e.chainNamespace)throw b.chainNamespaceNotAllowed("This adapter doesn't support this chainNamespace")}checkSwitchChainRequirements({chainId:e},t=!1){if(!t&&!this.provider)throw C.notConnectedError("Not connected with wallet.");if(!this.knownChainConfigs[e])throw C.chainConfigNotAdded("Invalid chainId")}updateAdapterData(e){this.adapterData=e,this.emit(D.ADAPTER_DATA_UPDATED,{adapterName:this.name,data:e})}addChainConfig(e){const t=this.knownChainConfigs[e.chainId];this.knownChainConfigs[e.chainId]=i(i({},t||{}),e)}getChainConfig(e){return this.knownChainConfigs[e]||null}}class W extends Error{}function $(e){try{return structuredClone(e)}catch(t){return JSON.parse(JSON.stringify(e,((e,t)=>"bigint"==typeof t?t.toString():t)))}}W.prototype.name="InvalidTokenError";var H=r(743),F=r.n(H),K=r(880),q=r.n(K);const X=q().getLogger("http-helpers");X.setLevel(K.levels.INFO);let B="torus-default";const z=async(e,t={},r={})=>{const n={mode:"cors",headers:{}};r.useAPIKey&&(n.headers=i(i({},n.headers),function(){const e={};return B&&(e["x-api-key"]=B),e}())),t.method="GET";const o=F()(n,t),a=await async function(e,t){let r=null;try{r=new URL(e)}catch(e){}return fetch(e,t)}(e,o);if(a.ok){const e=a.headers.get("content-type");return null!=e&&e.includes("application/json")?a.json():a.text()}throw function(e){X.info(`Response: ${e.status} ${e.statusText}`),X.info(`Url: ${e.url}`)}(a),a};function G(e){let t,r=!1,n=0;try{t=window[e],r=!0,n=t.length;const o="__storage_test__";return t.setItem(o,o),t.removeItem(o),!0}catch(e){const t=e;return!(!t||22!==t.code&&1014!==t.code&&"QuotaExceededError"!==t.name&&"NS_ERROR_DOM_QUOTA_REACHED"!==t.name||!r||0===n)}}const V=e=>("string"==typeof e||"number"==typeof e)&&/^(-)?0x[0-9a-f]*$/i.test(e),Y=e=>c[null!=e?e:p.SAPPHIRE_MAINNET],J=async(e,t)=>{const r=new URL(`${Y(t)}/api/configuration`);return r.searchParams.append("project_id",e),r.searchParams.append("network",t),r.searchParams.append("whitelist","true"),await z(r.href)},Q=async e=>await z(e||"https://assets.web3auth.io/v1/wallet-registry.json"),Z=e=>{let t=e.toLowerCase();return t=t.split("|")[0],t=t.replace(/-/g," "),t=t.replace(/\s+/g," "),t=t.replace(/wallet$/i,"").trim(),t=t.replace(/\s/g,"-"),t},ee=e=>{const t=function(e,t){if("string"!=typeof e)throw new W("Invalid token specified: must be a string");t||(t={});const r=!0===t.header?0:1,n=e.split(".")[r];if("string"!=typeof n)throw new W(`Invalid token specified: missing part #${r+1}`);let o;try{o=function(e){let t=e.replace(/-/g,"+").replace(/_/g,"/");switch(t.length%4){case 0:break;case 2:t+="==";break;case 3:t+="=";break;default:throw new Error("base64 string is not of the correct length")}try{return function(e){return decodeURIComponent(atob(e).replace(/(.)/g,((e,t)=>{let r=t.charCodeAt(0).toString(16).toUpperCase();return r.length<2&&(r="0"+r),"%"+r})))}(t)}catch(e){return atob(t)}}(n)}catch(e){throw new W(`Invalid token specified: invalid base64 for part #${r+1} (${e.message})`)}try{return JSON.parse(o)}catch(e){throw new W(`Invalid token specified: invalid json for part #${r+1} (${e.message})`)}}(e);return!t.exp||t.exp<Math.floor(Date.now()/1e3)},te=(e,t)=>G("localStorage")?localStorage.getItem(`${e.toLowerCase()}_${t}`):null,re=(e,t,r)=>G("localStorage")?localStorage.setItem(`${e.toLowerCase()}_${t}`,r):null,ne=(e,t)=>G("localStorage")?localStorage.removeItem(`${e.toLowerCase()}_${t}`):null,oe=q().getLogger("web3auth-logger");class ie extends w{constructor(e,t,r){super(e,t,r),Object.defineProperty(this,"name",{value:"WalletServicesPluginError"})}static fromCode(e,t="",r){return new ie(e,`${ie.messages[e]}${t}`,r)}static notInitialized(e="",t){return ie.fromCode(5210,e,t)}static unsupportedAdapter(e="",t){return ie.fromCode(5211,e,t)}static providerRequired(e="",t){return ie.fromCode(5212,e,t)}static web3authRequired(e="",t){return ie.fromCode(5213,e,t)}static web3AuthNotConnected(e="",t){return ie.fromCode(5214,e,t)}static alreadyInitialized(e="",t){return ie.fromCode(5216,e,t)}static unsupportedChainNamespace(e="",t){return ie.fromCode(5218,e,t)}static differentWeb3AuthNetwork(e="",t){return ie.fromCode(5219,e,t)}static invalidParams(e="",t){return ie.fromCode(5220,e,t)}static web3authNotInitialized(e="",t){return ie.fromCode(5221,e,t)}static invalidSession(e="",t){return ie.fromCode(5222,e,t)}static walletPluginNotConnected(e="",t){return ie.fromCode(5223,e,t)}}t(ie,"messages",{5210:"Wallet Services Plugin is not initialized",5211:"Web3Auth is connected to unsupported adapter. Wallet services connector plugin requires web3auth connected to auth adapter.",5212:"Provider is required..",5213:"Web3Auth instance is required while initialization.",5214:"Web3Auth is not connected.",5216:"Plugin is already initialized",5218:"Unsupported chain namespace.",5219:"Plugin network different than web3auth instance network.",5221:"Web3Auth is not initialized",5222:"Invalid session inside wallet services. Please report this issue.",5223:"Wallet plugin is not connected Yet. Please wait for plugin to connect and listen via `connected` event on the plugin"});const ae=i(i({},A),{},{MULTICHAIN:"multichain"}),se={READY:"ready",CONNECTING:"connecting",CONNECTED:"connected",DISCONNECTED:"disconnected",ERRORED:"errored"},ce=i({},se),le={WALLET_SERVICES:"wallet-services"},ue={SOLANA:"solana"},pe=i(i({},le),ue),de={INITIALIZED:"initialized",ERRORED:"errored"}})(),n})()));

@@ -58,3 +58,3 @@ 'use strict';

5210: "Wallet Services Plugin is not initialized",
5211: "Web3Auth is connected to unsupported adapter. Wallet services connector plugin requires web3auth connected to openlogin adapter.",
5211: "Web3Auth is connected to unsupported adapter. Wallet services connector plugin requires web3auth connected to auth adapter.",
5212: "Provider is required..",

@@ -61,0 +61,0 @@ 5213: "Web3Auth instance is required while initialization.",

@@ -6,3 +6,3 @@ 'use strict';

const MULTI_CHAIN_ADAPTERS = {
OPENLOGIN: "openlogin",
AUTH: "auth",
WALLET_CONNECT_V2: "wallet-connect-v2",

@@ -12,9 +12,6 @@ SFA: "sfa"

const SOLANA_ADAPTERS = _objectSpread({
TORUS_SOLANA: "torus-solana",
PHANTOM: "phantom",
SOLFLARE: "solflare"
TORUS_SOLANA: "torus-solana"
}, MULTI_CHAIN_ADAPTERS);
const EVM_ADAPTERS = _objectSpread({
TORUS_EVM: "torus-evm",
METAMASK: "metamask",
COINBASE: "coinbase"

@@ -24,10 +21,7 @@ }, MULTI_CHAIN_ADAPTERS);

const ADAPTER_NAMES = {
[MULTI_CHAIN_ADAPTERS.OPENLOGIN]: "OpenLogin",
[MULTI_CHAIN_ADAPTERS.AUTH]: "Auth",
[MULTI_CHAIN_ADAPTERS.WALLET_CONNECT_V2]: "Wallet Connect v2",
[MULTI_CHAIN_ADAPTERS.SFA]: "SFA",
[SOLANA_ADAPTERS.TORUS_SOLANA]: "Torus",
[SOLANA_ADAPTERS.PHANTOM]: "Phantom",
[SOLANA_ADAPTERS.SOLFLARE]: "Solflare",
[EVM_ADAPTERS.TORUS_EVM]: "Torus",
[EVM_ADAPTERS.METAMASK]: "Metamask",
[EVM_ADAPTERS.COINBASE]: "Coinbase"

@@ -34,0 +28,0 @@ };

@@ -56,3 +56,3 @@ import _defineProperty from '@babel/runtime/helpers/defineProperty';

5210: "Wallet Services Plugin is not initialized",
5211: "Web3Auth is connected to unsupported adapter. Wallet services connector plugin requires web3auth connected to openlogin adapter.",
5211: "Web3Auth is connected to unsupported adapter. Wallet services connector plugin requires web3auth connected to auth adapter.",
5212: "Provider is required..",

@@ -59,0 +59,0 @@ 5213: "Web3Auth instance is required while initialization.",

import _objectSpread from '@babel/runtime/helpers/objectSpread2';
const MULTI_CHAIN_ADAPTERS = {
OPENLOGIN: "openlogin",
AUTH: "auth",
WALLET_CONNECT_V2: "wallet-connect-v2",

@@ -9,9 +9,6 @@ SFA: "sfa"

const SOLANA_ADAPTERS = _objectSpread({
TORUS_SOLANA: "torus-solana",
PHANTOM: "phantom",
SOLFLARE: "solflare"
TORUS_SOLANA: "torus-solana"
}, MULTI_CHAIN_ADAPTERS);
const EVM_ADAPTERS = _objectSpread({
TORUS_EVM: "torus-evm",
METAMASK: "metamask",
COINBASE: "coinbase"

@@ -21,10 +18,7 @@ }, MULTI_CHAIN_ADAPTERS);

const ADAPTER_NAMES = {
[MULTI_CHAIN_ADAPTERS.OPENLOGIN]: "OpenLogin",
[MULTI_CHAIN_ADAPTERS.AUTH]: "Auth",
[MULTI_CHAIN_ADAPTERS.WALLET_CONNECT_V2]: "Wallet Connect v2",
[MULTI_CHAIN_ADAPTERS.SFA]: "SFA",
[SOLANA_ADAPTERS.TORUS_SOLANA]: "Torus",
[SOLANA_ADAPTERS.PHANTOM]: "Phantom",
[SOLANA_ADAPTERS.SOLFLARE]: "Solflare",
[EVM_ADAPTERS.TORUS_EVM]: "Torus",
[EVM_ADAPTERS.METAMASK]: "Metamask",
[EVM_ADAPTERS.COINBASE]: "Coinbase"

@@ -31,0 +25,0 @@ };

@@ -164,3 +164,3 @@ import { type AuthUserInfo, JRPCRequest, JRPCResponse, Maybe, RequestArguments, SafeEventEmitter, SendCallBack, UX_MODE, type UX_MODE_TYPE, WEB3AUTH_NETWORK, type WEB3AUTH_NETWORK_TYPE } from "@web3auth/auth";

/**
* Display Name. If not provided, we use the default for openlogin app
* Display Name. If not provided, we use the default for auth app
*/

@@ -173,11 +173,11 @@ name: string;

/**
* Logo to be shown on mouse hover. If not provided, we use the default for openlogin app
* Logo to be shown on mouse hover. If not provided, we use the default for auth app
*/
logoHover?: string;
/**
* Logo to be shown on dark background (dark theme). If not provided, we use the default for openlogin app
* Logo to be shown on dark background (dark theme). If not provided, we use the default for auth app
*/
logoLight?: string;
/**
* Logo to be shown on light background (light theme). If not provided, we use the default for openlogin app
* Logo to be shown on light background (light theme). If not provided, we use the default for auth app
*/

@@ -202,18 +202,4 @@ logoDark?: string;

}>;
export interface IWalletConnectExtensionAdapter {
name: string;
chains: ChainNamespaceType[];
logo: string;
mobile: {
native: string;
universal: string;
};
desktop: {
native: string;
universal: string;
};
}
export type WalletConnectV2Data = {
uri: string;
extensionAdapters: IWalletConnectExtensionAdapter[];
};
export declare const MULTI_CHAIN_ADAPTERS: {
OPENLOGIN: string;
AUTH: string;
WALLET_CONNECT_V2: string;

@@ -7,26 +7,20 @@ SFA: string;

export declare const SOLANA_ADAPTERS: {
OPENLOGIN: string;
AUTH: string;
WALLET_CONNECT_V2: string;
SFA: string;
TORUS_SOLANA: string;
PHANTOM: string;
SOLFLARE: string;
};
export declare const EVM_ADAPTERS: {
OPENLOGIN: string;
AUTH: string;
WALLET_CONNECT_V2: string;
SFA: string;
TORUS_EVM: string;
METAMASK: string;
COINBASE: string;
};
export declare const WALLET_ADAPTERS: {
OPENLOGIN: string;
AUTH: string;
WALLET_CONNECT_V2: string;
SFA: string;
TORUS_SOLANA: string;
PHANTOM: string;
SOLFLARE: string;
TORUS_EVM: string;
METAMASK: string;
COINBASE: string;

@@ -33,0 +27,0 @@ };

{
"name": "@web3auth/base",
"version": "9.0.0-alpha.0",
"version": "9.0.0-alpha.1",
"homepage": "https://github.com/Web3Auth/Web3Auth#readme",

@@ -58,3 +58,3 @@ "license": "ISC",

},
"gitHead": "6a4e65a5808cac7dfc4d750c2af7d9ae7410a162"
"gitHead": "8eed806fd76b4ded7e12f532ba706d59e9b98d0f"
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc