PageSourceSearch

https://decrypt.co/_next/static/chunks/a01ae74e.bb99b3baf90d6a86.js

js decrypt.co collected 2026-09-24 08:27:25 UTC 66,052 bytes, 1 lines download raw bytes

1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[64461],{93978:function(e,t,r){function i(e,t,r,i){return new(r||(r=Promise))(function(n,o){function s(e){try{u(i.next(e))}catch(e){o(e)}}function a(e){try{u(i.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?n(e.value):((t=e.value)instanceof r?t:new r(function(e){e(t)})).then(s,a)}u((i=i.apply(e,t||[])).next())})}function n(e,t,r,i){if("a"===r&&!i)throw TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!i:!t.has(e))throw TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?i:"a"===r?i.call(e):i?i.value:t.get(e)}function o(e,t){if(!e)throw Error(t)}r.d(t,{Z:function(){return tf}}),"function"==typeof SuppressedError&&SuppressedError,(E=A||(A={})).prod="BLOCTO_SDK",E.dev="BLOCTO_SDK_DEV",E.staging="BLOCTO_SDK_STAGING",(S=O||(O={})).ETHEREUM="ethereum",S.APTOS="aptos";let s={56:"https://bsc-dataseed1.binance.org",97:"https://data-seed-prebsc-1-s1.binance.org:8545",137:"https://rpc-mainnet.maticvigil.com/",80002:"https://rpc-amoy.polygon.technology/",43114:"https://api.avax.network/ext/bc/C/rpc",43113:"https://api.avax-test.network/ext/bc/C/rpc",42161:"https://arb1.arbitrum.io/rpc",421614:"https://arbitrum-sepolia.blockpi.network/v1/rpc/public",10:"https://mainnet.optimism.io",11155420:"https://sepolia.optimism.io",8453:"https://mainnet.base.org",84532:"https://sepolia.base.org",7777777:"https://rpc.zora.energy",999999999:"https://sepolia.rpc.zora.energy",534352:"https://rpc.scroll.io",534351:"https://sepolia-rpc.scroll.io",59144:"https://rpc.linea.build",1261120:"https://rpc.startale.com/zkatana",81457:"https://rpc.blast.io",168587773:"https://sepolia.blast.io"},a={prod:"https://wallet-v2.blocto.app",staging:"https://wallet-v2-staging.blocto.app",dev:"https://wallet-v2-dev.blocto.app"},u={prod:A.prod,staging:A.staging,dev:A.dev},h={1:A.prod,2:A.dev,3:A.dev,4:A.dev,5:A.staging},l={1:"https://wallet-v2.blocto.app",2:"https://wallet-v2-dev.blocto.app",3:"https://wallet-v2-dev.blocto.app",4:"https://wallet-v2-dev.blocto.app",5:"https://wallet-v2-staging.blocto.app"};(_=R||(R={})).Mainnet="mainnet",_.Testnet="testnet",_.Devnet="devnet",_.Testing="testing",_.Premainnet="premainnet";let c={1:R.Mainnet,2:R.Testnet,3:R.Devnet,4:R.Testing,5:R.Premainnet},d={1:"https://fullnode.mainnet.aptoslabs.com/v1",2:"https://fullnode.testnet.aptoslabs.com/v1",3:"https://fullnode.devnet.aptoslabs.com/v1",4:"",5:"https://premainnet.aptosdev.com/v1"},f=["connect","disconnect","message","chainChanged","accountsChanged"],p="00000000-0000-0000-0000-000000000000",v="0.10.2";class g{constructor(){this.isBlocto=!0,this.isConnecting=!1,this.eventListeners={},this.off=this.removeListener,f.forEach(e=>{this.eventListeners[e]=[]}),this.appId=p}request(e){return i(this,void 0,void 0,function*(){})}on(e,t){f.includes(e)&&this.eventListeners[e].push(t)}once(){}removeListener(e,t){let r=this.eventListeners[e].findIndex(e=>e===t);-1!==r&&this.eventListeners[e].splice(r,1)}}function y(e){let t=document.createElement("iframe");return t.setAttribute("src",e),t.setAttribute("style","width:100vw;height:100%;position:fixed;top:0;left:0;z-index:2147483646;border:none;box-sizing:border-box;color-scheme:light;inset:0px;display:block;pointer-events:auto;"),t}function m(e){document.body.appendChild(e)}function b(e){let t=e&&e.parentNode;t&&t.removeChild instanceof Function&&t.removeChild(e)}var w,E,S,_,A,O,R,P,I,T,C,N,j,D=(e,t,r=window)=>{r.addEventListener(e,function i(n){t(n,()=>r.removeEventListener(e,i))})};class k{constructor(){this.storage={}}getItem(e){return this[e]||null}setItem(e,t){this.storage[e]=t}removeItem(e){delete this.storage[e]}}let x="undefined"!=typeof window?window.memoryStorage:new k,L=(()=>{if("undefined"==typeof window)return!1;try{window.sessionStorage.setItem("local_storage_supported","1");let e=window.sessionStorage.getItem("local_storage_supported");return window.sessionStorage.removeItem("local_storage_supported"),"1"===e}catch(e){return!1}})()?window.sessionStorage:x,U=(e,t=null)=>{let r=L.getItem(e);try{return r&&JSON.parse(r)||t}catch(e){return r||t}},M=(e,t)=>L.setItem(e,"string"==typeof t?t:JSON.stringify(t)),B=e=>{M(e,""),L.removeItem(e)},K=e=>{let t=U(e,null);return t?new Date().getTime()>t.expiry||t.v!==v?(B(e),null):null==t?void 0:t.data:null},$=(e,t,r)=>{var i,n,o;let s=U(e);M(e,{data:{code:(null==t?void 0:t.code)||(null===(i=null==s?void 0:s.data)||void 0===i?void 0:i.code),accounts:Object.assign(Object.assign({},null===(n=null==s?void 0:s.data)||void 0===n?void 0:n.accounts),null==t?void 0:t.accounts),evm:Object.assign(Object.assign({},null===(o=null==s?void 0:s.data)||void 0===o?void 0:o.evm),null==t?void 0:t.evm)},expiry:r||(null==s?void 0:s.expiry)||new Date().getTime()+864e5,v:v})},q=(e,t)=>
1{var r,i,n;return(null===(r=K(e))||void 0===r?void 0:r.code)?(null===(n=null===(i=K(e))||void 0===i?void 0:i.accounts)||void 0===n?void 0:n[t])||null:(B(e),null)},Y=(e,t,r)=>{$(e,{accounts:{[t]:r}})},V=(e,t)=>{$(e,{accounts:{[t]:void 0}})},F=(e,t)=>{var r,i,n;return(null===(r=K(e))||void 0===r?void 0:r.code)?(null===(n=null===(i=K(e))||void 0===i?void 0:i.evm)||void 0===n?void 0:n[t])||null:(B(e),null)},z=(e,t,r)=>{$(e,{evm:{[t]:r}})},J=e=>{let t=U(e);t&&(t.data.evm={},M(e,t))};function G(e,t,r){return i(this,void 0,void 0,function*(){if((403===e.status||401===e.status)&&(r&&r(),B(t)),!e.ok){let t=yield e.json(),r=Error((null==t?void 0:t.message)||"unknown error");throw r.error_code=null==t?void 0:t.error_code,r}return e.json()})}let H=e=>/\S+@\S+\.\S+/.test(e);(w=P||(P={})).INVALID_TRANSACTION="Invalid transaction",w.INVALID_TRANSACTIONS="Invalid transactions",w.INVALID_TRANSACTION_VALUE='Transaction params "value" should be hex-encoded string';var W="undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},X=[],Z=[],Q="undefined"!=typeof Uint8Array?Uint8Array:Array,ee=!1;function et(){ee=!0;for(var e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",t=0,r=e.length;t<r;++t)X[t]=e[t],Z[e.charCodeAt(t)]=t;Z["-".charCodeAt(0)]=62,Z["_".charCodeAt(0)]=63}function er(e){ee||et();for(var t,r=e.length,i=r%3,n="",o=[],s=0,a=r-i;s<a;s+=16383)o.push(function(e,t,r){for(var i,n=[],o=t;o<r;o+=3)n.push(X[(i=(e[o]<<16)+(e[o+1]<<8)+e[o+2])>>18&63]+X[i>>12&63]+X[i>>6&63]+X[63&i]);return n.join("")}(e,s,s+16383>a?a:s+16383));return 1===i?n+=X[(t=e[r-1])>>2]+X[t<<4&63]+"==":2===i&&(n+=X[(t=(e[r-2]<<8)+e[r-1])>>10]+X[t>>4&63]+X[t<<2&63]+"="),o.push(n),o.join("")}function ei(e,t,r,i,n){var o,s,a=8*n-i-1,u=(1<<a)-1,h=u>>1,l=-7,c=r?n-1:0,d=r?-1:1,f=e[t+c];for(c+=d,o=f&(1<<-l)-1,f>>=-l,l+=a;l>0;o=256*o+e[t+c],c+=d,l-=8);for(s=o&(1<<-l)-1,o>>=-l,l+=i;l>0;s=256*s+e[t+c],c+=d,l-=8);if(0===o)o=1-h;else{if(o===u)return s?NaN:1/0*(f?-1:1);s+=Math.pow(2,i),o-=h}return(f?-1:1)*s*Math.pow(2,o-i)}function en(e,t,r,i,n,o){var s,a,u,h=8*o-n-1,l=(1<<h)-1,c=l>>1,d=23===n?5960464477539062e-23:0,f=i?0:o-1,p=i?1:-1,v=t<0||0===t&&1/t<0?1:0;for(isNaN(t=Math.abs(t))||t===1/0?(a=isNaN(t)?1:0,s=l):(s=Math.floor(Math.log(t)/Math.LN2),t*(u=Math.pow(2,-s))<1&&(s--,u*=2),s+c>=1?t+=d/u:t+=d*Math.pow(2,1-c),t*u>=2&&(s++,u/=2),s+c>=l?(a=0,s=l):s+c>=1?(a=(t*u-1)*Math.pow(2,n),s+=c):(a=t*Math.pow(2,c-1)*Math.pow(2,n),s=0));n>=8;e[r+f]=255&a,f+=p,a/=256,n-=8);for(s=s<<n|a,h+=n;h>0;e[r+f]=255&s,f+=p,s/=256,h-=8);e[r+f-p]|=128*v}var eo={}.toString,es=Array.isArray||function(e){return"[object Array]"==eo.call(e)};function ea(){return eh.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function eu(e,t){if(ea()<t)throw RangeError("Invalid typed array length");return eh.TYPED_ARRAY_SUPPORT?(e=new Uint8Array(t)).__proto__=eh.prototype:(null===e&&(e=new eh(t)),e.length=t),e}function eh(e,t,r){if(!eh.TYPED_ARRAY_SUPPORT&&!(this instanceof eh))return new eh(e,t,r);if("number"==typeof e){if("string"==typeof t)throw Error("If encoding is specified then the first argument must be a string");return ed(this,e)}return el(this,e,t,r)}function el(e,t,r,i){if("number"==typeof t)throw TypeError('"value" argument must not be a number');return"undefined"!=typeof ArrayBuffer&&t instanceof ArrayBuffer?function(e,t,r,i){if(t.byteLength,r<0||t.byteLength<r)throw RangeError("'offset' is out of bounds");if(t.byteLength<r+(i||0))throw RangeError("'length' is out of bounds");return t=void 0===r&&void 0===i?new Uint8Array(t):void 0===i?new Uint8Array(t,r):new Uint8Array(t,r,i),eh.TYPED_ARRAY_SUPPORT?(e=t).__proto__=eh.prototype:e=ef(e,t),e}(e,t,r,i):"string"==typeof t?function(e,t,r){if(("string"!=typeof r||""===r)&&(r="utf8"),!eh.isEncoding(r))throw TypeError('"encoding" must be a valid string encoding');var i=0|eg(t,r),n=(e=eu(e,i)).write(t,r);return n!==i&&(e=e.slice(0,n)),e}(e,t,r):function(e,t){if(ev(t)){var r,i=0|ep(t.length);return 0===(e=eu(e,i)).length||t.copy(e,0,0,i),e}if(t){if("undefined"!=typeof ArrayBuffer&&t.buffer instanceof ArrayBuffer||"length"in t)return"number"!=typeof t.length||(r=t.length)!=r?eu(e,0):ef(e,t);if("Buffer"===t.type&&es(t.data))return ef(e,t.data)}throw TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}(e,t)}function ec(e){if("number"!=typeof e)throw TypeError('"size" argument must be a number');if(e<0)throw RangeError('"size" argument must not be negative')}function ed(e,t){if(ec(t),e=eu(e,t<0?0:0|ep(t)),!eh.TYPED_ARRAY_SUPPORT)for(var r=0;r<t;++r)e[r]=0;return e}function ef(e,t){var r=t.length<0?0:0|ep(t.length);e=eu(e,r);for(var i=0;i<r;i+=1)e[i]=255&t[i];return e}function ep(e){if(e>=ea())throw RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+ea().toString(16)+" bytes");return 0|e}function ev(e){return!!(null!=e&&e._isBuffer)}function eg(e,t){if(ev(e))return e.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&
1(ArrayBuffer.isView(e)||e instanceof ArrayBuffer))return e.byteLength;"string"!=typeof e&&(e=""+e);var r=e.length;if(0===r)return 0;for(var i=!1;;)switch(t){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":case void 0:return eC(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return ej(e).length;default:if(i)return eC(e).length;t=(""+t).toLowerCase(),i=!0}}function ey(e,t,r){var i,n,o=!1;if((void 0===t||t<0)&&(t=0),t>this.length||((void 0===r||r>this.length)&&(r=this.length),r<=0||(r>>>=0)<=(t>>>=0)))return"";for(e||(e="utf8");;)switch(e){case"hex":return function(e,t,r){var i,n=e.length;(!t||t<0)&&(t=0),(!r||r<0||r>n)&&(r=n);for(var o="",s=t;s<r;++s)o+=(i=e[s])<16?"0"+i.toString(16):i.toString(16);return o}(this,t,r);case"utf8":case"utf-8":return eE(this,t,r);case"ascii":return function(e,t,r){var i="";r=Math.min(e.length,r);for(var n=t;n<r;++n)i+=String.fromCharCode(127&e[n]);return i}(this,t,r);case"latin1":case"binary":return function(e,t,r){var i="";r=Math.min(e.length,r);for(var n=t;n<r;++n)i+=String.fromCharCode(e[n]);return i}(this,t,r);case"base64":return i=t,n=r,0===i&&n===this.length?er(this):er(this.slice(i,n));case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return function(e,t,r){for(var i=e.slice(t,r),n="",o=0;o<i.length;o+=2)n+=String.fromCharCode(i[o]+256*i[o+1]);return n}(this,t,r);default:if(o)throw TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),o=!0}}function em(e,t,r){var i=e[t];e[t]=e[r],e[r]=i}function eb(e,t,r,i,n){if(0===e.length)return -1;if("string"==typeof r?(i=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),isNaN(r=+r)&&(r=n?0:e.length-1),r<0&&(r=e.length+r),r>=e.length){if(n)return -1;r=e.length-1}else if(r<0){if(!n)return -1;r=0}if("string"==typeof t&&(t=eh.from(t,i)),ev(t))return 0===t.length?-1:ew(e,t,r,i,n);if("number"==typeof t)return(t&=255,eh.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf)?n?Uint8Array.prototype.indexOf.call(e,t,r):Uint8Array.prototype.lastIndexOf.call(e,t,r):ew(e,[t],r,i,n);throw TypeError("val must be string, number or Buffer")}function ew(e,t,r,i,n){var o,s=1,a=e.length,u=t.length;if(void 0!==i&&("ucs2"===(i=String(i).toLowerCase())||"ucs-2"===i||"utf16le"===i||"utf-16le"===i)){if(e.length<2||t.length<2)return -1;s=2,a/=2,u/=2,r/=2}function h(e,t){return 1===s?e[t]:e.readUInt16BE(t*s)}if(n){var l=-1;for(o=r;o<a;o++)if(h(e,o)===h(t,-1===l?0:o-l)){if(-1===l&&(l=o),o-l+1===u)return l*s}else -1!==l&&(o-=o-l),l=-1}else for(r+u>a&&(r=a-u),o=r;o>=0;o--){for(var c=!0,d=0;d<u;d++)if(h(e,o+d)!==h(t,d)){c=!1;break}if(c)return o}return -1}function eE(e,t,r){r=Math.min(e.length,r);for(var i=[],n=t;n<r;){var o,s,a,u,h=e[n],l=null,c=h>239?4:h>223?3:h>191?2:1;if(n+c<=r)switch(c){case 1:h<128&&(l=h);break;case 2:(192&(o=e[n+1]))==128&&(u=(31&h)<<6|63&o)>127&&(l=u);break;case 3:o=e[n+1],s=e[n+2],(192&o)==128&&(192&s)==128&&(u=(15&h)<<12|(63&o)<<6|63&s)>2047&&(u<55296||u>57343)&&(l=u);break;case 4:o=e[n+1],s=e[n+2],a=e[n+3],(192&o)==128&&(192&s)==128&&(192&a)==128&&(u=(15&h)<<18|(63&o)<<12|(63&s)<<6|63&a)>65535&&u<1114112&&(l=u)}null===l?(l=65533,c=1):l>65535&&(l-=65536,i.push(l>>>10&1023|55296),l=56320|1023&l),i.push(l),n+=c}return function(e){var t=e.length;if(t<=4096)return String.fromCharCode.apply(String,e);for(var r="",i=0;i<t;)r+=String.fromCharCode.apply(String,e.slice(i,i+=4096));return r}(i)}function eS(e,t,r){if(e%1!=0||e<0)throw RangeError("offset is not uint");if(e+t>r)throw RangeError("Trying to access beyond buffer length")}function e_(e,t,r,i,n,o){if(!ev(e))throw TypeError('"buffer" argument must be a Buffer instance');if(t>n||t<o)throw RangeError('"value" argument is out of bounds');if(r+i>e.length)throw RangeError("Index out of range")}function eA(e,t,r,i){t<0&&(t=65535+t+1);for(var n=0,o=Math.min(e.length-r,2);n<o;++n)e[r+n]=(t&255<<8*(i?n:1-n))>>>(i?n:1-n)*8}function eO(e,t,r,i){t<0&&(t=4294967295+t+1);for(var n=0,o=Math.min(e.length-r,4);n<o;++n)e[r+n]=t>>>(i?n:3-n)*8&255}function eR(e,t,r,i,n,o){if(r+i>e.length||r<0)throw RangeError("Index out of range")}function eP(e,t,r,i,n){return n||eR(e,t,r,4),en(e,t,r,i,23,4),r+4}function eI(e,t,r,i,n){return n||eR(e,t,r,8),en(e,t,r,i,52,8),r+8}eh.TYPED_ARRAY_SUPPORT=void 0===W.TYPED_ARRAY_SUPPORT||W.TYPED_ARRAY_SUPPORT,ea(),eh.poolSize=8192,eh._augment=function(e){return e.__proto__=eh.prototype,e},eh.from=function(e,t,r){return el(null,e,t,r)},eh.TYPED_ARRAY_SUPPORT&&(eh.prototype.__proto__=Uint8Array.prototype,eh.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&eh[Symbol.species]),eh.alloc=function(e,t,r){return(ec(e),e<=0)?eu(null,e):void 0!==t?"string"==typeof r?eu(null,e).fill(t,r):eu(null,e).fill(t):eu(null,e)},eh.allocUnsafe=function(e){return ed(null,e)},eh.allocUnsafeSlow=function(e){return ed(null,e)},eh.isBuffer=function(e){return null!=e&&(!!e._isBuffer||ek(e)||"function"==typeof e.readFloatLE&&"function"==typeof e.slice&&ek(e.slice(0,0)))},eh.compare=function(e,t){if(!ev(e)||!ev(t))throw TypeError("Arguments must be Buffers");if(e===t)return 0;for(var r=e.length,i=t.length,n=0,o=Math.min(r,i);n<o;++n)if(e[n]!==t[n]){r=e[n],i=t[n];break}return r<i?-1:i<r?1:0},eh.isEncoding=function(e){switch(String(e).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},eh.concat=function(e,t){if(!es(e))throw TypeError('"list" argument must be an Array of Buffers');if(0===e.length)return eh.alloc(0);if(void 0===t)for(r=0,t=0;r<e.length;++r)t+=e[r].length;var r,i=eh.allocUnsafe(t),n=0;for(r=0;r<e.length;++r){var o=e[r];if(!ev(o))throw TypeError('"list" argument must be an Array of Buffers');o.copy(i,n),n+=o.length}return i},eh.byteLength=eg,eh.prototype._isBuffer=!0,eh.prototype.swap16=function(){var e=this.length;if(e%2!=0)throw RangeError("Buffer size must be a multiple of 16-bits");for(var t=0;t<e;t+=2)em(this,t,t+1);return this},eh.prototype.swap32=function(){var e=this.length;if(e%4!=0)throw RangeError("Buffer size must be a multiple of 32-bits");for(var t=0;t<e;t+=4)em(this,t,t+3),em(this,t+1,t+2);return this},eh.prototype.swap64=function(){var e=this.length;if(e%8!=0)throw RangeError("Buffer size must be a multiple of 64-bits");for(var t=0;t<e;t+=8)em(this,t,t+7),em(this,t+1,t+6),em(this,t+2,t+5),em(this,t+3,t+4);return this},eh.prototype.toString=function(){var e=0|this.length;return 0===e?"":0==arguments.length?eE(this,0,e):ey.apply(this,arguments)},eh.prototype.equals=function(e){if(!ev(e))throw TypeError("Argument must be a Buffer");return this===e||0===eh.compare(this,e)},eh.prototype.inspect=function(){var e="";return this.length>0&&(e=this.toString("hex",0,50).match(/.{2}/g).join(" "),this.length>50&&(e+=" ... ")),"<Buffer "+e+">"},eh.prototype.compare=function(e,t,r,i,n){if(!ev(e))throw TypeError("Argument must be a Buffer");if(void 0===t&&(t=0),void 0===r&&(r=e?e.length:0),void 0===i&&(i=0),void 0===n&&(n=this.length),t<0||r>e.length||i<0||n>this.length)throw RangeError("out of range index");if(i>=n&&t>=r)return 0;if(i>=n)return -1;if(t>=r)return 1;if(t>>>=0,r>>>=0,i>>>=0,n>>>=0,this===e)return 0;for(var o=n-i,s=r-t,a=Math.min(o,s),u=this.slice(i,n),h=e.slice(t,r),l=0;l<a;++l)if(u[l]!==h[l]){o=u[l],s=h[l];break}return o<s?-1:s<o?1:0},eh.prototype.includes=function(e,t,r){return -1!==this.indexOf(e,t,r)},eh.prototype.indexOf=function(e,t,r){return eb(this,e,t,r,!0)},eh.prototype.lastIndexOf=function(e,t,r){return eb(this,e,t,r,!1)},eh.prototype.write=function(e,t,r,i){if(void 0===t)i="utf8",r=this.length,t=0;else if(void 0===r&&"string"==typeof t)i=t,r=this.length,t=0;else if(isFinite(t))t|=0,isFinite(r)?(r|=0,void 0===i&&(i="utf8")):(i=r,r=void 0);else throw Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");var n,o,s,a,u,h,l,c,d,f,p,v,g=this.length-t;if((void 0===r||r>g)&&(r=g),e.length>0&&(r<0||t<0)||t>this.length)throw RangeError("Attempt to write outside buffer bounds");i||(i="utf8");for(var y=!1;;)switch(i){case"hex":return function(e,t,r,i){r=Number(r)||0;var n=e.length-r;i?(i=Number(i))>n&&(i=n):i=n;var o=t.length;if(o%2!=0)throw TypeError("Invalid hex string");i>o/2&&(i=o/2);for(var s=0;s<i;++s){var a=parseInt(t.substr(2*s,2),16);if(isNaN(a))break;e[r+s]=a}return s}(this,e,t,r);case"utf8":case"utf-8":return u=t,h=r,eD(eC(e,this.length-u),this,u,h);case"ascii":return l=t,c=r,eD(eN(e),this,l,c);case"latin1":case"binary":return n=this,o=e,s=t,a=r,eD(eN(o),n,s,a);case"base64":return d=t,f=r,eD(ej(e),this,d,f);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return p=t,v=r,eD(function(e,t){for(var r,i,n=[],o=0;o<e.length&&!((t-=2)<0);++o)i=(r=e.charCodeAt(o))>>8,n.push(r%256),n.push(i);return n}(e,this.length-p),this,p,v);default:if(y)throw TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),y=!0}},eh.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}},eh.prototype.slice=function(e,t){var r,i=this.length;if(e=~~e,t=void 0===t?i:~~t,e<0?(e+=i)<0&&(e=0):e>i&&(e=i),t<0?(t+=i)<0&&(t=0):t>i&&(t=i),t<e&&(t=e),eh.TYPED_ARRAY_SUPPORT)(r=this.subarray(e,t)).__proto__=eh.prototype;else{var n=t-e;r=new eh(n,void 0);for(var o=0;o<n;++o)r[o]=this[o+e]}return r},eh.prototype.readUIntLE=function(e,t,r){e|=0,t|=0,r||eS(e,t,this.length);for(var i=this[e],n=1,o=0;++o<t&&(n*=256);)i+=this[e+o]*n;return i},eh.prototype.readUIntBE=function(e,t,r){e|=0,t|=0,r||eS(e,t,this.length);for(var i=this[e+--t],n=1;t>0&&(n*=256);)i+=this[e+--t]*n;return i},eh.prototype.readUInt8=function(e,t){return t||eS(e,1,this.length),this[e]},eh.prototype.readUInt16LE=function(e,t){return t||eS(e,2,this.length),this[e]|this[e+1]<<8},eh.prototype.readUInt16BE=function(e,t){return t||eS(e,2,this.length),this[e]<<8|this[e+1]},eh.prototype.readUInt32LE=function(e,t){return t||eS(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},eh.prototype.readUInt32BE=function(e,t){return t||eS(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},eh.prototype.readIntLE=function(e,t,r){e|=0,t|=0,r||eS(e,t,this.length);for(var i=this[e],n=1,o=0;++o<t&&(n*=256);)i+=this[e+o]*n;return i>=(n*=128)&&(i-=Math.pow(2,8*t)),i},eh.prototype.readIntBE=function(e,t,r){e|=0,t|=0,r||eS(e,t,this.length);for(var i=t,n=1,o=this[e+--i];i>0&&(n*=256);)o+=this[e+--i]*n;return o>=(n*=128)&&(o-=Math.pow(2,8*t)),o},eh.prototype.readInt8=function(e,t){return(t||eS(e,1,this.length),128&this[e])?-((255-this[e]+1)*1):this[e]},eh.prototype.readInt16LE=function(e,t){t||eS(e,2,this.length);var r=this[e]|this[e+1]<<8;return 32768&r?4294901760|r:r},eh.prototype.readInt16BE=function(e,t){t||eS(e,2,this.length);var r=this[e+1]|this[e]<<8;return 32768&r?4294901760|r:r},eh.prototype.readInt32LE=function(e,t){return t||eS(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},eh.prototype.readInt32BE=function(e,t){return t||eS(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},eh.prototype.readFloatLE=function(e,t){return t||eS(e,4,this.length),ei(this,e,!0,23,4)},eh.prototype.readFloatBE=function(e,t){return t||eS(e,4,this.length),ei(this,e,!1,23,4)},eh.prototype.readDoubleLE=function(e,t){return t||eS(e,8,this.length),ei(this,e,!0,52,8)},eh.prototype.readDoubleBE=function(e,t){return t||eS(e,8,this.length),ei(this,e,!1,52,8)},eh.prototype.writeUIntLE=function(e,t,r,i){if(e=+e,t|=0,r|=0,!i){var n=Math.pow(2,8*r)-1;e_(this,e,t,r,n,0)}var o=1,s=0;for(this[t]=255&e;++s<r&&(o*=256);)this[t+s]=e/o&255;return t+r},eh.prototype.writeUIntBE=function(e,t,r,i){if(e=+e,t|=0,r|=0,!i){var n=Math.pow(2,8*r)-1;e_(this,e,t,r,n,0)}var o=r-1,s=1;for(this[t+o]=255&e;--o>=0&&(s*=256);)this[t+o]=e/s&255;return t+r},eh.prototype.writeUInt8=function(e,t,r){return e=+e,t|=0,r||e_(this,e,t,1,255,0),eh.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[t]=255&e,t+1},eh.prototype.writeUInt16LE=function(e,t,r){return e=+e,t|=0,r||e_(this,e,t,2,65535,0),eh.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):eA(this,e,t,!0),t+2},eh.prototype.writeUInt16BE=function(e,t,r){return e=+e,t|=0,r||e_(this,e,t,2,65535,0),eh.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):eA(this,e,t,!1),t+2},eh.prototype.writeUInt32LE=function(e,t,r){return e=+e,t|=0,r||e_(this,e,t,4,4294967295,0),eh.TYPED_ARRAY_SUPPORT?(this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e):eO(this,e,t,!0),t+4},eh.prototype.writeUInt32BE=function(e,t,r){return e=+e,t|=0,r||e_(this,e,t,4,4294967295,0),eh.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):eO(this,e,t,!1),t+4},eh.prototype.writeIntLE=function(e,t,r,i){if(e=+e,t|=0,!i){var n=Math.pow(2,8*r-1);e_(this,e,t,r,n-1,-n)}var o=0,s=1,a=0;for(this[t]=255&e;++o<r&&(s*=256);)e<0&&0===a&&0!==this[t+o-1]&&(a=1),this[t+o]=(e/s>>0)-a&255;return t+r},eh.prototype.writeIntBE=function(e,t,r,i){if(e=+e,t|=0,!i){var n=Math.pow(2,8*r-1);e_(this,e,t,r,n-1,-n)}var o=r-1,s=1,a=0;for(this[t+o]=255&e;--o>=0&&(s*=256);)e<0&&0===a&&0!==this[t+o+1]&&(a=1),this[t+o]=(e/s>>0)-a&255;return t+r},eh.prototype.writeInt8=function(e,t,r){return e=+e,t|=0,r||e_(this,e,t,1,127,-128),eh.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),e<0&&(e=255+e+1),this[t]=255&e,t+1},eh.prototype.writeInt16LE=function(e,t,r){return e=+e,t|=0,r||e_(this,e,t,2,32767,-32768),eh.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):eA(this,e,t,!0),t+2},eh.prototype.writeInt16BE=function(e,t,r){return e=+e,t|=0,r||e_(this,e,t,2,32767,-32768),eh.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):eA(this,e,t,!1),t+2},eh.prototype.writeInt32LE=function(e,t,r){return e=+e,t|=0,r||e_(this,e,t,4,2147483647,-2147483648),eh.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24):eO(this,e,t,!0),t+4},eh.prototype.writeInt32BE=function(e,t,r){return e=+e,t|=0,r||e_(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),eh.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):eO(this,e,t,!1),t+4},eh.prototype.writeFloatLE=function(e,t,r){return eP(this,e,t,!0,r)},eh.prototype.writeFloatBE=function(e,t,r){return eP(this,e,t,!1,r)},eh.prototype.writeDoubleLE=function(e,t,r){return eI(this,e,t,!0,r)},eh.prototype.writeDoubleBE=function(e,t,r){return eI(this,e,t,!1,r)},eh.prototype.copy=function(e,t,r,i){if(r||(r=0),i||0===i||(i=this.length),t>=e.length&&(t=e.length),t||(t=0),i>0&&i<r&&(i=r),i===r||0===e.length||0===this.length)return 0;if(t<0)throw RangeError("targetStart out of bounds");if(r<0||r>=this.length)throw RangeError("sourceStart out of bounds");if(i<0)throw RangeError("sourceEnd out of bounds");i>this.length&&(i=this.length),e.length-t<i-r&&(i=e.length-t+r);var n,o=i-r;if(this===e&&r<t&&t<i)for(n=o-1;n>=0;--n)e[n+t]=this[n+r];else if(o<1e3||!eh.TYPED_ARRAY_SUPPORT)for(n=0;n<o;++n)e[n+t]=this[n+r];else Uint8Array.prototype.set.call(e,this.subarray(r,r+o),t);return o},eh.prototype.fill=function(e,t,r,i){if("string"==typeof e){if("string"==typeof t?(i=t,t=0,r=this.length):"string"==typeof r&&(i=r,r=this.length),1===e.length){var n,o=e.charCodeAt(0);o<256&&(e=o)}if(void 0!==i&&"string"!=typeof i)throw TypeError("encoding must be a string");if("string"==typeof i&&!eh.isEncoding(i))throw TypeError("Unknown encoding: "+i)}else"number"==typeof e&&(e&=255);if(t<0||this.length<t||this.length<r)throw RangeError("Out of range index");if(r<=t)return this;if(t>>>=0,r=void 0===r?this.length:r>>>0,e||(e=0),"number"==typeof e)for(n=t;n<r;++n)this[n]=e;else{var s=ev(e)?e:eC(new eh(e,i).toString()),a=s.length;for(n=0;n<r-t;++n)this[n+t]=s[n%a]}return this};var eT=/[^+\/0-9A-Za-z-_]/g;
1function eC(e,t){t=t||1/0;for(var r,i=e.length,n=null,o=[],s=0;s<i;++s){if((r=e.charCodeAt(s))>55295&&r<57344){if(!n){if(r>56319||s+1===i){(t-=3)>-1&&o.push(239,191,189);continue}n=r;continue}if(r<56320){(t-=3)>-1&&o.push(239,191,189),n=r;continue}r=(n-55296<<10|r-56320)+65536}else n&&(t-=3)>-1&&o.push(239,191,189);if(n=null,r<128){if((t-=1)<0)break;o.push(r)}else if(r<2048){if((t-=2)<0)break;o.push(r>>6|192,63&r|128)}else if(r<65536){if((t-=3)<0)break;o.push(r>>12|224,r>>6&63|128,63&r|128)}else if(r<1114112){if((t-=4)<0)break;o.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}else throw Error("Invalid code point")}return o}function eN(e){for(var t=[],r=0;r<e.length;++r)t.push(255&e.charCodeAt(r));return t}function ej(e){return function(e){ee||et();var t,r,i,n,o,s,a=e.length;if(a%4>0)throw Error("Invalid string. Length must be a multiple of 4");o="="===e[a-2]?2:"="===e[a-1]?1:0,s=new Q(3*a/4-o),i=o>0?a-4:a;var u=0;for(t=0,r=0;t<i;t+=4,r+=3)n=Z[e.charCodeAt(t)]<<18|Z[e.charCodeAt(t+1)]<<12|Z[e.charCodeAt(t+2)]<<6|Z[e.charCodeAt(t+3)],s[u++]=n>>16&255,s[u++]=n>>8&255,s[u++]=255&n;return 2===o?(n=Z[e.charCodeAt(t)]<<2|Z[e.charCodeAt(t+1)]>>4,s[u++]=255&n):1===o&&(n=Z[e.charCodeAt(t)]<<10|Z[e.charCodeAt(t+1)]<<4|Z[e.charCodeAt(t+2)]>>2,s[u++]=n>>8&255,s[u++]=255&n),s}(function(e){var t;if((e=((t=e).trim?t.trim():t.replace(/^\s+|\s+$/g,"")).replace(eT,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function eD(e,t,r,i){for(var n=0;n<i&&!(n+r>=t.length)&&!(n>=e.length);++n)t[n+r]=e[n];return n}function ek(e){return!!e.constructor&&"function"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e)}let ex=e=>"string"==typeof e&&/^0x[0-9A-Fa-f]*$/.test(e),eL=e=>eh.from(e,"utf8").toString("hex"),eU=e=>e&&"object"==typeof e&&"from"in e?e.value&&!ex(e.value)?{isValid:!1,invalidMsg:P.INVALID_TRANSACTION_VALUE}:{isValid:!0}:{isValid:!1,invalidMsg:P.INVALID_TRANSACTION},eM=e=>{if(!Array.isArray(e))return{isValid:!1,invalidMsg:P.INVALID_TRANSACTIONS};for(let t=0;t<e.length;t++){let{isValid:r,invalidMsg:i}=eU(e[t]);if(!r)return{isValid:r,invalidMsg:i}}return{isValid:!0}};function eB(){return i(this,void 0,void 0,function*(){let{networks:e}=yield fetch("https://api.blocto.app/networks/evm").then(e=>e.json());return e.reduce((e,t)=>Object.assign(Object.assign({},e),{[t.chain_id]:t}),{})})}var eK={};function e$(e,t){if(!(e instanceof t))throw TypeError("Cannot call a class as a function")}function eq(e){return(eq="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)}function eY(e,t){for(var r=0;r<t.length;r++){var i=t[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,function(e){var t=function(e,t){if("object"!==eq(e)||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var i=r.call(e,t||"default");if("object"!==eq(i))return i;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"===eq(t)?t:String(t)}(i.key),i)}}function eV(e,t,r){return t&&eY(e.prototype,t),r&&eY(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function eF(e,t){return(eF=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e})(e,t)}function ez(e,t){if("function"!=typeof t&&null!==t)throw TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&eF(e,t)}function eJ(e){return(eJ=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function eG(e,t,r){return(eG=!function(){if("undefined"==typeof Reflect||!Reflect.construct||Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(e){return!1}}()?function(e,t,r){var i=[null];i.push.apply(i,t);var n=new(Function.bind.apply(e,i));return r&&eF(n,r.prototype),n}:Reflect.construct.bind()).apply(null,arguments)}function eH(e){var t="function"==typeof Map?new Map:void 0;return(eH=function(e){if(null===e||-1===Function.toString.call(e).indexOf("[native code]"))return e;if("function"!=typeof e)throw TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,r)}function r(){return eG(e,arguments,eJ(this).constructor)}return r.prototype=Object.create(e.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),eF(r,e)})(e)}var eW={};e2.default=e2,e2.stable=e4,e2.stableStringify=e4;var eX="[...]",eZ="[Circular]",eQ=[],e0=[];function e1(){return{depthLimit:Number.MAX_SAFE_INTEGER,edgesLimit:Number.MAX_SAFE_INTEGER}}
1function e2(e,t,r,i){void 0===i&&(i=e1()),function e(t,r,i,n,o,s,a){if(s+=1,"object"===eq(t)&&null!==t){for(u=0;u<n.length;u++)if(n[u]===t){e3(eZ,t,r,o);return}if(void 0!==a.depthLimit&&s>a.depthLimit||void 0!==a.edgesLimit&&i+1>a.edgesLimit){e3(eX,t,r,o);return}if(n.push(t),Array.isArray(t))for(u=0;u<t.length;u++)e(t[u],u,u,n,t,s,a);else{var u,h=Object.keys(t);for(u=0;u<h.length;u++){var l=h[u];e(t[l],l,u,n,t,s,a)}}n.pop()}}(e,"",0,[],void 0,0,i);try{n=0===e0.length?JSON.stringify(e,t,r):JSON.stringify(e,e5(t),r)}catch(e){return JSON.stringify("[unable to serialize, circular reference is too complex to analyze]")}finally{for(;0!==eQ.length;){var n,o=eQ.pop();4===o.length?Object.defineProperty(o[0],o[1],o[3]):o[0][o[1]]=o[2]}}return n}function e3(e,t,r,i){var n=Object.getOwnPropertyDescriptor(i,r);void 0!==n.get?n.configurable?(Object.defineProperty(i,r,{value:e}),eQ.push([i,r,t,n])):e0.push([t,r,e]):(i[r]=e,eQ.push([i,r,t]))}function e6(e,t){return e<t?-1:e>t?1:0}function e4(e,t,r,i){void 0===i&&(i=e1());var n,o=function e(t,r,i,n,o,s,a){if(s+=1,"object"===eq(t)&&null!==t){for(u=0;u<n.length;u++)if(n[u]===t){e3(eZ,t,r,o);return}try{if("function"==typeof t.toJSON)return}catch(e){return}if(void 0!==a.depthLimit&&s>a.depthLimit||void 0!==a.edgesLimit&&i+1>a.edgesLimit){e3(eX,t,r,o);return}if(n.push(t),Array.isArray(t))for(u=0;u<t.length;u++)e(t[u],u,u,n,t,s,a);else{var u,h={},l=Object.keys(t).sort(e6);for(u=0;u<l.length;u++){var c=l[u];e(t[c],c,u,n,t,s,a),h[c]=t[c]}if(void 0===o)return h;eQ.push([o,r,t]),o[r]=h}n.pop()}}(e,"",0,[],void 0,0,i)||e;try{n=0===e0.length?JSON.stringify(o,t,r):JSON.stringify(o,e5(t),r)}catch(e){return JSON.stringify("[unable to serialize, circular reference is too complex to analyze]")}finally{for(;0!==eQ.length;){var s=eQ.pop();4===s.length?Object.defineProperty(s[0],s[1],s[3]):s[0][s[1]]=s[2]}}return n}function e5(e){return e=void 0!==e?e:function(e,t){return t},function(t,r){if(e0.length>0)for(var i=0;i<e0.length;i++){var n=e0[i];if(n[1]===t&&n[0]===r){r=n[2],e0.splice(i,1);break}}return e.call(this,t,r)}}function e8(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct||Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(e){return!1}}();return function(){var r,i=eJ(e);return r=t?Reflect.construct(i,arguments,eJ(this).constructor):i.apply(this,arguments),function(e,t){if(t&&("object"===eq(t)||"function"==typeof t))return t;if(void 0!==t)throw TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(this,r)}}Object.defineProperty(eW,"__esModule",{value:!0}),eW.EthereumProviderError=eW.EthereumRpcError=void 0;var e9=function(e){ez(r,e);var t=e8(r);function r(e,i,n){var o;if(e$(this,r),!Number.isInteger(e))throw Error('"code" must be an integer.');if(!i||"string"!=typeof i)throw Error('"message" must be a nonempty string.');return(o=t.call(this,i)).code=e,void 0!==n&&(o.data=n),o}return eV(r,[{key:"serialize",value:function(){var e={code:this.code,message:this.message};return void 0!==this.data&&(e.data=this.data),this.stack&&(e.stack=this.stack),e}},{key:"toString",value:function(){return e2.default(this.serialize(),te,2)}}]),r}(eH(Error));eW.EthereumRpcError=e9;var e7=function(e){ez(r,e);var t=e8(r);function r(e,i,n){if(e$(this,r),!(Number.isInteger(e)&&e>=1e3&&e<=4999))throw Error('"code" must be an integer such that: 1000 <= code <= 4999');return t.call(this,e,i,n)}return eV(r)}(e9);function te(e,t){if("[Circular]"!==t)return t}eW.EthereumProviderError=e7;var tt={},tr={};function ti(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,i=Array(t);r<t;r++)i[r]=e[r];return i}function tn(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var i,n,o,s,a=[],u=!0,h=!1;try{if(o=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;u=!1}else for(;!(u=(i=o.call(r)).done)&&(a.push(i.value),a.length!==t);u=!0);}catch(e){h=!0,n=e}
1finally{try{if(!u&&null!=r.return&&(s=r.return(),Object(s)!==s))return}finally{if(h)throw n}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return ti(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if("Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return ti(e,t)}}(e,t)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}Object.defineProperty(tr,"__esModule",{value:!0}),tr.errorValues=tr.errorCodes=void 0,tr.errorCodes={rpc:{invalidInput:-32e3,resourceNotFound:-32001,resourceUnavailable:-32002,transactionRejected:-32003,methodNotSupported:-32004,limitExceeded:-32005,parse:-32700,invalidRequest:-32600,methodNotFound:-32601,invalidParams:-32602,internal:-32603},provider:{userRejectedRequest:4001,unauthorized:4100,unsupportedMethod:4200,disconnected:4900,chainDisconnected:4901}},tr.errorValues={"-32700":{standard:"JSON RPC 2.0",message:"Invalid JSON was received by the server. An error occurred on the server while parsing the JSON text."},"-32600":{standard:"JSON RPC 2.0",message:"The JSON sent is not a valid Request object."},"-32601":{standard:"JSON RPC 2.0",message:"The method does not exist / is not available."},"-32602":{standard:"JSON RPC 2.0",message:"Invalid method parameter(s)."},"-32603":{standard:"JSON RPC 2.0",message:"Internal JSON-RPC error."},"-32000":{standard:"EIP-1474",message:"Invalid input."},"-32001":{standard:"EIP-1474",message:"Resource not found."},"-32002":{standard:"EIP-1474",message:"Resource unavailable."},"-32003":{standard:"EIP-1474",message:"Transaction rejected."},"-32004":{standard:"EIP-1474",message:"Method not supported."},"-32005":{standard:"EIP-1474",message:"Request limit exceeded."},4001:{standard:"EIP-1193",message:"User rejected the request."},4100:{standard:"EIP-1193",message:"The requested account and/or method has not been authorized by the user."},4200:{standard:"EIP-1193",message:"The requested method is not supported by this Ethereum provider."},4900:{standard:"EIP-1193",message:"The provider is disconnected from all chains."},4901:{standard:"EIP-1193",message:"The provider is disconnected from the specified chain."}},function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.serializeError=e.isValidCode=e.getMessageFromCode=e.JSON_RPC_SERVER_ERROR_MESSAGE=void 0;var t=tr.errorCodes.rpc.internal,r={code:t,message:i(t)};function i(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"Unspecified error message. This is a bug, please report it.";if(Number.isInteger(t)){var i=t.toString();if(s(tr.errorValues,i))return tr.errorValues[i].message;if(t>=-32099&&t<=-32e3)return e.JSON_RPC_SERVER_ERROR_MESSAGE}return r}function n(e){if(!Number.isInteger(e))return!1;var t=e.toString();return!!(tr.errorValues[t]||e>=-32099&&e<=-32e3)}function o(e){return e&&"object"===eq(e)&&!Array.isArray(e)?Object.assign({},e):e}function s(e,t){return Object.prototype.hasOwnProperty.call(e,t)}e.JSON_RPC_SERVER_ERROR_MESSAGE="Unspecified server error.",e.getMessageFromCode=i,e.isValidCode=n,e.serializeError=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},a=t.fallbackError,u=void 0===a?r:a,h=t.shouldIncludeStack;if(!u||!Number.isInteger(u.code)||"string"!=typeof u.message)throw Error("Must provide fallback error with integer number code and string message.");if(e instanceof eW.EthereumRpcError)return e.serialize();var l={};if(e&&"object"===eq(e)&&!Array.isArray(e)&&s(e,"code")&&n(e.code))l.code=e.code,e.message&&"string"==typeof e.message?(l.message=e.message,s(e,"data")&&(l.data=e.data)):(l.message=i(l.code),l.data={originalError:o(e)});else{l.code=u.code;var c=null==e?void 0:e.message;l.message=c&&"string"==typeof c?c:u.message,l.data={originalError:o(e)}}var d=null==e?void 0:e.stack;return void 0!==h&&h&&e&&d&&"string"==typeof d&&(l.stack=d),l}}(tt);var to={};function ts(e,t){var r=tn(tu(t),2),i=r[0],n=r[1];return new eW.EthereumRpcError(e,i||tt.getMessageFromCode(e),n)}function ta(e,t){var r=tn(tu(t),2),i=r[0],n=r[1];return new eW.EthereumProviderError(e,i||tt.getMessageFromCode(e),n)}function tu(e){if(e){if("string"==typeof e)return[e];if("object"===eq(e)&&!Array.isArray(e)){var t=e.message,r=e.data;
1if(t&&"string"!=typeof t)throw Error("Must specify string message.");return[t||void 0,r]}}return[]}function th(e){return e?"number"==typeof e?e:e.startsWith("0x")?parseInt(e,16):parseInt(e,10):1}Object.defineProperty(to,"__esModule",{value:!0}),to.ethErrors=void 0,to.ethErrors={rpc:{parse:function(e){return ts(tr.errorCodes.rpc.parse,e)},invalidRequest:function(e){return ts(tr.errorCodes.rpc.invalidRequest,e)},invalidParams:function(e){return ts(tr.errorCodes.rpc.invalidParams,e)},methodNotFound:function(e){return ts(tr.errorCodes.rpc.methodNotFound,e)},internal:function(e){return ts(tr.errorCodes.rpc.internal,e)},server:function(e){if(!e||"object"!==eq(e)||Array.isArray(e))throw Error("Ethereum RPC Server errors must provide single object argument.");var t=e.code;if(!Number.isInteger(t)||t>-32005||t<-32099)throw Error('"code" must be an integer such that: -32099 <= code <= -32005');return ts(t,e)},invalidInput:function(e){return ts(tr.errorCodes.rpc.invalidInput,e)},resourceNotFound:function(e){return ts(tr.errorCodes.rpc.resourceNotFound,e)},resourceUnavailable:function(e){return ts(tr.errorCodes.rpc.resourceUnavailable,e)},transactionRejected:function(e){return ts(tr.errorCodes.rpc.transactionRejected,e)},methodNotSupported:function(e){return ts(tr.errorCodes.rpc.methodNotSupported,e)},limitExceeded:function(e){return ts(tr.errorCodes.rpc.limitExceeded,e)}},provider:{userRejectedRequest:function(e){return ta(tr.errorCodes.provider.userRejectedRequest,e)},unauthorized:function(e){return ta(tr.errorCodes.provider.unauthorized,e)},unsupportedMethod:function(e){return ta(tr.errorCodes.provider.unsupportedMethod,e)},disconnected:function(e){return ta(tr.errorCodes.provider.disconnected,e)},chainDisconnected:function(e){return ta(tr.errorCodes.provider.chainDisconnected,e)},custom:function(e){if(!e||"object"!==eq(e)||Array.isArray(e))throw Error("Ethereum Provider custom errors must provide single object argument.");var t=e.code,r=e.message,i=e.data;if(!r||"string"!=typeof r)throw Error('"message" must be a nonempty string');return new eW.EthereumProviderError(t,r,i)}}},Object.defineProperty(eK,"__esModule",{value:!0}),eK.getMessageFromCode=eK.serializeError=eK.EthereumProviderError=eK.EthereumRpcError=eK.ethErrors=eK.errorCodes=void 0,Object.defineProperty(eK,"EthereumRpcError",{enumerable:!0,get:function(){return eW.EthereumRpcError}}),Object.defineProperty(eK,"EthereumProviderError",{enumerable:!0,get:function(){return eW.EthereumProviderError}}),Object.defineProperty(eK,"serializeError",{enumerable:!0,get:function(){return tt.serializeError}}),Object.defineProperty(eK,"getMessageFromCode",{enumerable:!0,get:function(){return tt.getMessageFromCode}}),Object.defineProperty(eK,"ethErrors",{enumerable:!0,get:function(){return to.ethErrors}}),Object.defineProperty(eK,"errorCodes",{enumerable:!0,get:function(){return tr.errorCodes}});class tl extends g{get existedSDK(){if("undefined"!=typeof window)return window.ethereum}constructor(e){var t;if(super(),I.add(this),this.networkVersion="1",this.off=this.removeListener,this.injectedWalletServer=e.walletServer,this._blocto={sessionKeyEnv:A.prod,walletServer:this.injectedWalletServer||"",blockchainName:"",networkType:"",switchableNetwork:{}},this.appId=e.appId||p,"chainId"in e){let{chainId:t,rpc:r}=e;o(t,"'chainId' is required"),this.networkVersion=`${th(t)}`,this.chainId=`0x${th(t).toString(16)}`,this.rpc=r||s[this.networkVersion],o(this.rpc,"'rpc' is required")}else{let{defaultChainId:r,switchableChains:i}=e;o(r,"'defaultChainId' is required"),this.networkVersion=`${th(r)}`,this.chainId=`0x${th(r).toString(16)}`;let n=i.find(e=>th(e.chainId)===th(r));if(!n)throw eK.ethErrors.provider.custom({code:1001,message:`Chain ${r} is not in switchableChains list`});this.rpc=(null===(t=n.rpcUrls)||void 0===t?void 0:t[0])||s[this.networkVersion],o(this.rpc,"'rpc' is required"),this._blocto.unloadedNetwork=i}}send(e,t){return i(this,void 0,void 0,function*(){switch(!0){case t instanceof Function:return this.sendAsync(e,t);case"string"==typeof e&&Array.isArray(t):return this.sendAsync({jsonrpc:"2.0",method:e,params:t});default:return this.sendAsync(e)}})}sendAsync(e,t){return i(this,void 0,void 0,function*(){let r=e=>e.reduce((e,t)=>
1{var r;return"eth_sendTransaction"===t.method?e.sendRequests.push(null===(r=t.params)||void 0===r?void 0:r[0]):e.otherRequests.push(this.request(t)),e},{sendRequests:[],otherRequests:[]}),i=new Promise(t=>{if(Array.isArray(e)){let{sendRequests:i,otherRequests:n}=r(e),o=0===i.length,s=Math.floor(1e4*Math.random());Promise.allSettled(o?[...n]:[this.request({method:"wallet_sendMultiCallTransaction",params:[i,!1]}),...n]).then(r=>o?t(r.map((t,r)=>{var i;return{id:String((null===(i=e[r])||void 0===i?void 0:i.id)||s+r+1),jsonrpc:"2.0",method:e[r].method,result:"fulfilled"===t.status?t.value:void 0,error:"fulfilled"!==t.status?t.reason:void 0}})):t(function(e,t){let r=[],i=1;return e.forEach(e=>{let n={id:String(e.id),jsonrpc:"2.0",method:e.method};"eth_sendTransaction"===e.method?(n.result=t[0].value,n.error="fulfilled"!==t[0].status?t[0].reason:void 0):i<t.length&&(n.result=t[i].value,n.error="fulfilled"!==t[i].status?t[i].reason:void 0,i++),r.push(n)}),r}(e,r))).catch(e=>{throw eK.ethErrors.rpc.internal(null==e?void 0:e.message)})}else this.request(Object.assign(Object.assign({},e),{id:Number(e.id)})).then(t)});if("function"!=typeof t)return i;i.then(e=>t(null,e)).catch(e=>t(e))})}sendUserOperation(e){return i(this,void 0,void 0,function*(){return this.request({method:"eth_sendUserOperation",params:[e]})})}request(e){var t,r,o,s,a,u,h,l;return i(this,void 0,void 0,function*(){if(Array.isArray(e))return this.sendAsync(e);if(!(null==e?void 0:e.method))throw eK.ethErrors.rpc.invalidRequest();let{blockchainName:i,switchableNetwork:c,sessionKeyEnv:d}=yield n(this,I,"m",T).call(this);if(null===(t=this.existedSDK)||void 0===t?void 0:t.isBlocto){if("wallet_switchEthereumChain"===e.method){if(!(null===(o=null===(r=null==e?void 0:e.params)||void 0===r?void 0:r[0])||void 0===o?void 0:o.chainId))throw eK.ethErrors.rpc.invalidParams();return this.existedSDK.request(e).then(()=>{var t,r,i;return this.networkVersion=`${th(null===(t=null==e?void 0:e.params)||void 0===t?void 0:t[0].chainId)}`,this.chainId=`0x${th(null===(r=null==e?void 0:e.params)||void 0===r?void 0:r[0].chainId).toString(16)}`,this.rpc=null===(i=null==c?void 0:c[this.networkVersion])||void 0===i?void 0:i.rpc_url,null})}return this.existedSDK.request(e)}switch(e.method){case"eth_chainId":return this.chainId;case"net_version":return this.networkVersion;case"wallet_addEthereumChain":return this.loadSwitchableNetwork((null==e?void 0:e.params)||[]);case"eth_blockNumber":case"web3_clientVersion":case"eth_call":{let t=yield this.handleReadRequests(e);if(!t||t&&!t.result&&t.error){let e=(null===(s=null==t?void 0:t.error)||void 0===s?void 0:s.message)?t.error.message:"Request failed";throw eK.ethErrors.rpc.internal(e)}return"function"==typeof(null==e?void 0:e.callback)&&e.callback(null,t.result),t.result}case"wallet_switchEthereumChain":return this.handleSwitchChain(null===(u=null===(a=null==e?void 0:e.params)||void 0===a?void 0:a[0])||void 0===u?void 0:u.chainId);case"wallet_disconnect":return this.handleDisconnect();case"eth_accounts":return F(d,i)||[]}if(!F(d,i)){let t=null===(h=null==e?void 0:e.params)||void 0===h?void 0:h[0];"eth_requestAccounts"===e.method&&H(t)?yield this.enable(t):yield this.enable()}try{let t=null,r=null;switch(e.method){case"eth_requestAccounts":r=yield this.fetchAccounts();break;case"eth_coinbase":r=null===(l=F(d,i))||void 0===l?void 0:l[0];break;case"eth_signTypedData_v3":case"eth_signTypedData":case"eth_signTypedData_v4":case"personal_sign":r=yield this.handleSign(e);break;case"eth_sign":throw eK.ethErrors.rpc.methodNotFound("Method Not Supported: eth_sign has been disabled");case"eth_sendTransaction":r=yield this.handleSendTransaction(e);break;case"wallet_sendMultiCallTransaction":r=yield this.handleSendBatchTransaction(e);break;case"eth_signTransaction":case"eth_sendRawTransaction":throw eK.ethErrors.rpc.methodNotSupported("Method Not Supported: "+e.method);case"eth_sendUserOperation":r=yield this.handleSendUserOperation(e);break;case"eth_estimateUserOperationGas":case"eth_getUserOperationByHash":case"eth_getUserOperationReceipt":case"eth_supportedEntryPoints":r=yield this.handleBu
1ndler(e);break;default:t=yield this.handleReadRequests(e)}if(t&&!t.result&&t.error){let e=t.error.message?t.error.message:"Request failed";throw eK.ethErrors.rpc.internal(e)}if(t)return t.result;return r}catch(e){throw eK.ethErrors.rpc.internal(null==e?void 0:e.message)}})}bloctoApi(e,t){var r;return i(this,void 0,void 0,function*(){let{walletServer:i,blockchainName:o,sessionKeyEnv:s}=yield n(this,I,"m",T).call(this),a=(null===(r=K(s))||void 0===r?void 0:r.code)||"";if(!a)throw eK.ethErrors.provider.unauthorized();return fetch(`${i}/api/${o}${e}`,Object.assign({headers:{"Content-Type":"application/json","Blocto-Application-Identifier":this.appId,"Blocto-Session-Identifier":a}},t)).then(e=>G(e,s,()=>{var e;null===(e=this.eventListeners)||void 0===e||e.disconnect.forEach(e=>e(eK.ethErrors.provider.disconnected()))})).catch(e=>{if((null==e?void 0:e.error_code)==="unsupported_method")throw eK.ethErrors.rpc.methodNotSupported("Method Not Supported: "+e.message);throw eK.ethErrors.rpc.server({code:-32005,message:`Blocto server error: ${e.message}`})})})}responseListener(e,t){return i(this,void 0,void 0,function*(){let{walletServer:r}=yield n(this,I,"m",T).call(this);return new Promise((i,n)=>D("message",(o,s)=>{o.origin===r&&"ETH:FRAME:RESPONSE"===o.data.type&&("APPROVED"===o.data.status&&(s(),b(e),i(o.data[t])),"DECLINED"===o.data.status&&(s(),b(e),"incorrect_session_id"===o.data.errorCode&&this.handleDisconnect(),n(eK.ethErrors.provider.userRejectedRequest(o.data.errorMessage)))),"ETH:FRAME:CLOSE"===o.data.type&&(s(),b(e),n(eK.ethErrors.provider.userRejectedRequest("User declined the request")))}))})}setIframe(e,t){return i(this,void 0,void 0,function*(){if("undefined"==typeof window)throw eK.ethErrors.provider.custom({code:1001,message:"Blocto SDK only works in browser environment"});let{walletServer:r,blockchainName:i}=yield n(this,I,"m",T).call(this),o=y(`${r}/${this.appId}/${t||i}${e}`);return m(o),o})}enable(e){var t;return i(this,void 0,void 0,function*(){if("undefined"==typeof window)throw eK.ethErrors.provider.custom({code:1001,message:"Blocto SDK only works in browser environment"});let{walletServer:r,blockchainName:i,sessionKeyEnv:o}=yield n(this,I,"m",T).call(this);if(null===(t=this.existedSDK)||void 0===t?void 0:t.isBlocto)return this.existedSDK.chainId!==this.chainId&&(yield this.existedSDK.request({method:"wallet_addEthereumChain",params:[{chainId:this.chainId}]}),yield this.existedSDK.request({method:"wallet_switchEthereumChain",params:[{chainId:this.chainId}]}),z(o,i,[this.existedSDK.address])),new Promise((e,t)=>setTimeout(()=>this.existedSDK.enable().then(e).catch(t),10));let s=F(o,i);if(s)return new Promise(e=>{e(s)});let a=new URLSearchParams;a.set("l6n",window.location.origin),a.set("v",v),a.set("q",`${window.location.pathname}${window.location.search}`);let u=e&&H(e)?`/${e}`:"",h=yield this.setIframe(`/authn${u}?${a.toString()}`);return new Promise((e,t)=>{D("message",(n,s)=>{var a,u;n.origin===r&&("ETH:FRAME:RESPONSE"===n.data.type&&(s(),b(h),null===(a=this.eventListeners)||void 0===a||a.connect.forEach(e=>e({chainId:this.chainId})),$(o,{code:n.data.code,evm:{[i]:[n.data.addr]}},n.data.exp),(null===(u=n.data)||void 0===u?void 0:u.isAccountChanged)&&postMessage({originChain:O.ETHEREUM,type:"BLOCTO_SDK:ACCOUNT_CHANGED"}),D("message",(e,t)=>{var r,i,o;let s=(null===(r=e.data)||void 0===r?void 0:r.type)==="BLOCTO_SDK:ACCOUNT_CHANGED",a=(null===(i=e.data)||void 0===i?void 0:i.originChain)!==O.ETHEREUM;s&&(null===(o=this.eventListeners)||void 0===o||o.accountsChanged.forEach(e=>e([n.data.addr]))),s&&a&&(this.handleDisconnect(),t())}),e([n.data.addr])),"ETH:FRAME:CLOSE"===n.data.type&&(s(),b(h),t(eK.ethErrors.provider.userRejectedRequest())))})})})}fetchAccounts(){return i(this,void 0,void 0,function*(){n(this,I,"m",N).call(this);let{blockchainName:e,sessionKeyEnv:t}=yield n(this,I,"m",T).call(this),{accounts:r}=yield this.bloctoApi("/accounts");return z(t,e,r),r})}handleReadRequests(e){return i(this,void 0,void 0,function*(){return n(this,I,"m",N).call(this),fetch(this.rpc,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(Object.assign({id:1,jsonrpc:"2.0"},e))}).then(e=>e.json()).catch(e=>{throw eK.ethErrors.rpc.internal(e)})})}handleSign({method:e,params:t}){return i(this,void 0,void 0,function*(){let r="";if(Array.isArray(t)){if("personal_sign"===e)r=ex(t[0])?t[0].slice(2):eL(t[0]);else if(["eth_signTypedData","eth_signTypedData_v3","eth_signTypedData_v4"].includes(e)){let{domain:e}=JSON.parse(r=t[1]);if(ex(e.chainId))throw eK.ethErrors.rpc.invalidParams(`Provided chainId "${e.chainId}" must be a number`);if(th(e.chainId)!==th(this.chainId))throw eK.ethErrors.rpc.invalidParams(`Provided chainId "${e.chainId}" must match the active chainId "${th(this.chainId)}"`)}}n(this,I,"m",N).call(this);let{signatureId:i}=yield this.bloctoApi("/user-signature",{method:"POST",body:JSON.stringify({method:e,message:r})}),o=yield this.setIframe(`/user-signature/${i}`);return this.responseListener(o,"signature")})}handleSwitchChain(e){var t,r;return i(this,void 0,void 0,function*(){if(!e)throw eK.ethErrors.rpc.invalidParams();let{walletServer:i,blockchainName:o,sessionKeyEnv:s,switchableNetwork:a}=yield n(this,I,"m",T).call(this),u=null===(t=F(s,o))||void 0===t?void 0:t[0],h=th(this.chainId),l=th(e);if(h===l)return null;if(!a[l])throw eK.ethErrors.provider.custom({code:4902,message:`Unrecognized chain ID "${l}". Try adding the chain using wallet_addEthereumChain first.`});if(this.networkVersion=`${l}
1`,this.chainId=`0x${l.toString(16)}`,this.rpc=a[l].rpc_url,this._blocto=Object.assign(Object.assign({},this._blocto),{blockchainName:"",networkType:""}),!u)return null===(r=this.eventListeners)||void 0===r||r.chainChanged.forEach(e=>e(this.chainId)),yield n(this,I,"m",T).call(this),null;if(a[l].wallet_web_url!==a[h].wallet_web_url)return this.enable().then(([e])=>{var t;return e!==u&&(null===(t=this.eventListeners)||void 0===t||t.accountsChanged.forEach(t=>t([e]))),this.eventListeners.chainChanged.forEach(e=>e(this.chainId)),null}).catch(e=>{throw this.networkVersion=`${h}`,this.chainId=`0x${h.toString(16)}`,this.rpc=a[h].rpc_url,this._blocto=Object.assign(Object.assign({},this._blocto),{blockchainName:"",networkType:""}),n(this,I,"m",T).call(this),e});let c=yield this.setIframe(`/switch-chain?to=${a[l].name}`,a[h].name);return new Promise((e,t)=>{D("message",(r,o)=>{var d,f,p,v,g,y,m,w;r.origin===i&&("ETH:FRAME:RESPONSE"===r.data.type&&(o(),b(c),(null===(d=r.data)||void 0===d?void 0:d.addr)&&u&&($(s,{code:null===(f=r.data)||void 0===f?void 0:f.code,evm:{[a[l].name]:[r.data.addr]}},null===(p=r.data)||void 0===p?void 0:p.exp),r.data.addr!==u&&(null===(v=this.eventListeners)||void 0===v||v.accountsChanged.forEach(e=>e([r.data.addr])))),null===(g=this.eventListeners)||void 0===g||g.chainChanged.forEach(e=>e(this.chainId)),n(this,I,"m",T).call(this),e(null)),"ETH:FRAME:CLOSE"===r.data.type&&(o(),b(c),(null===(y=r.data)||void 0===y?void 0:y.hasApprovedSwitchChain)?(null===(m=this.eventListeners)||void 0===m||m.chainChanged.forEach(e=>e(this.chainId)),J(s),null===(w=this.eventListeners)||void 0===w||w.disconnect.forEach(e=>e(eK.ethErrors.provider.disconnected())),n(this,I,"m",T).call(this),e(null)):(this.networkVersion=`${h}`,this.chainId=`0x${h.toString(16)}`,this.rpc=a[h].rpc_url,this._blocto=Object.assign(Object.assign({},this._blocto),{blockchainName:"",networkType:""}),n(this,I,"m",T).call(this),t(eK.ethErrors.provider.userRejectedRequest()))))})})})}handleSendTransaction(e){var t;return i(this,void 0,void 0,function*(){n(this,I,"m",N).call(this);let{isValid:r,invalidMsg:i}=eU(null===(t=e.params)||void 0===t?void 0:t[0]);if(!r)throw eK.ethErrors.rpc.invalidParams(i);return n(this,I,"m",j).call(this,e.params)})}handleSendBatchTransaction(e){return i(this,void 0,void 0,function*(){let t,r;n(this,I,"m",N).call(this),Array.isArray(e.params)&&e.params.length>=2?[t,r]=e.params:(t=e.params,r=!1);let i=!!r&&r,{isValid:o,invalidMsg:s}=eM(t);if(!o)throw eK.ethErrors.rpc.invalidParams(s);return n(this,I,"m",j).call(this,t,i)})}handleSendUserOperation(e){return i(this,void 0,void 0,function*(){n(this,I,"m",N).call(this);let{authorizationId:t}=yield this.bloctoApi("/user-operation",{method:"POST",body:JSON.stringify(e.params)}),r=yield this.setIframe(`/user-operation/${t}`);return this.responseListener(r,"userOpHash")})}handleBundler(e){return i(this,void 0,void 0,function*(){return n(this,I,"m",N).call(this),this.bloctoApi("/rpc/bundler",{method:"POST",body:JSON.stringify(Object.assign({id:1,jsonrpc:"2.0"},e))})})}handleDisconnect(){var e,t;return i(this,void 0,void 0,function*(){if(null===(e=this.existedSDK)||void 0===e?void 0:e.isBlocto)return this.existedSDK.request({method:"wallet_disconnect"});let{sessionKeyEnv:r}=yield n(this,I,"m",T).call(this);J(r),null===(t=this.eventListeners)||void 0===t||t.disconnect.forEach(e=>e(eK.ethErrors.provider.disconnected()))})}loadSwitchableNetwork(e){return i(this,void 0,void 0,function*(){if(null==e?void 0:e.length)return Promise.all(e.map(({chainId:e,rpcUrls:t})=>{if(!e)throw eK.ethErrors.rpc.invalidParams("Empty chainId");let r=`${th(e)}`;if(this._blocto.switchableNetwork[r])return null;let i=(null==t?void 0:t[0])||s[r];if(!i)throw eK.ethErrors.rpc.invalidParams("rpcUrls required");return n(this,I,"m",C).call(this,{chainId:r,rpcUrls:[i]})})).then(()=>null);throw eK.ethErrors.rpc.invalidParams("Empty networkList")})}supportChainList(){return i(this,void 0,void 0,function*(){let e=yield eB().catch(e=>{throw eK.ethErrors.provider.custom({code:1001,message:`Get blocto server failed: ${e.message}`})});return Object.keys(e).map(t=>{let{display_name:r}=e[t];return{chainId:t,chainName:r}})})}on(e,t){var r;(null===(r=this.existedSDK)||void 0===r?void 0:r.isBlocto)&&this.existedSDK.on(e,t),super.on(e,t)}removeListener(e,t){var r;(null===(r=this.existedSDK)||void 0===r?void 0:r.isBlocto)&&this.existedSDK.off(e,t),super.removeListener(e,t)}}I=new WeakSet,T=function(){var e,t;return i(this,void 0,void 0,function*(){if((null===(e=this._blocto)||void 0===e?void 0:e.unloadedNetwork)&&(yield this.loadSwitchableNetwork(this._blocto.unloadedNetwork),delete this._blocto.unloadedNetwork),this._blocto.sessionKeyEnv&&this._blocto.walletServer&&this._blocto.blockchainName&&this._blocto.networkType&&this._blocto.switchableNetwork)return this._blocto;let{chain_id:r,name:i,network_type:n,blocto_service_environment:o,display_name:s}=null!==(t=(yield eB().catch(e=>{throw eK.ethErrors.provider.custom({code:1001,message:`Get blocto server failed: ${e.message}`})}))[this.networkVersion])&&void 0!==t?t:{};if(!r)throw eK.ethErrors.provider.unsupportedMethod(`Get support chain failed: ${this.networkVersion} might not be supported yet.`);let h=this.injectedWalletServer||a[o];return this._blocto=Object.assign(Object.assign({},this._blocto),{sessionKeyEnv:u[o],walletServer:h,blockchainName:i,networkType:n,switchableNetwork:Object.assign(Object.assign({},this._blocto.switchableNetwork),{[r]:{name:i,display_name:s,network_type:n,wallet_web_url:h,rpc_url:this.rpc}})}),this._blocto})},C=function({chainId:e,rpcUrls:t}){var r;return i(this,void 0,void 0,function*(){yield n(this,I,"m",T).call(this);let{chain_id:i,name:o,display_name:s,network_type:u,blocto_service_environment:h}=null!==(r=(yield eB().catch(e=>{throw eK.ethErrors.provider.custom({code:1001,message:`Get blocto server failed: ${e.message}`})}))[e])&&void 0!==r?r:{};if(!i)throw eK.ethErrors.provider.unsupportedMethod(`Get support chain failed: ${e} might not be supported yet.`);let l=a[h];this._blocto.switchableNetwork[i]={name:o,display_name:s,network_type:u,w
1allet_web_url:l,rpc_url:t[0]}})},N=function(){var e;if((null===(e=this.existedSDK)||void 0===e?void 0:e.isBlocto)&&th(this.existedSDK.chainId)!==th(this.chainId))throw eK.ethErrors.provider.chainDisconnected()},j=function(e,t=!0){return i(this,void 0,void 0,function*(){let{authorizationId:r}=yield this.bloctoApi("/authz",{method:"POST",body:JSON.stringify([e,t])}),i=new URLSearchParams;i.set("l6n",window.location.origin),i.set("q",`${window.location.pathname}${window.location.search}`);let n=yield this.setIframe(`/authz/${r}?${i.toString()}`);return this.responseListener(n,"txHash")})};let tc=e=>{var t,r;let i=Object.assign({},e),{message:n,nonce:o,address:s,application:a,chainId:u}=e;return"string"!=typeof n&&(i.message=null!==(t=String(n))&&void 0!==t?t:""),"string"!=typeof o&&(i.nonce=null!==(r=String(o))&&void 0!==r?r:""),s&&"boolean"!=typeof s&&(i.address=!!s),a&&"boolean"!=typeof a&&(i.application=!!a),u&&"boolean"!=typeof u&&(i.chainId=!!u),i};class td extends g{get existedSDK(){if("undefined"!=typeof window)return window.bloctoAptos}constructor({chainId:e,server:t,appId:r}){super(),this.publicKey=[],this.authKey="",this.off=this.removeListener,o(e,"'chainId' is required"),o(r,"It is necessary to interact with Blocto wallet via your app id. Please visit https://developers.blocto.app for more details."),this.chainId=e,this.networkName=c[e],this.api=d[e],this.sessionKey=h[e];let i=l[e];this.appId=r||p,this.server=t||i||""}get publicAccount(){var e;return{address:(null===(e=q(this.sessionKey,O.APTOS))||void 0===e?void 0:e[0])||null,publicKey:this.publicKey.length?this.publicKey:null,authKey:null,minKeysRequired:2}}network(){return i(this,void 0,void 0,function*(){return{name:this.networkName,api:this.api,chainId:this.chainId.toString()}})}isConnected(){var e;return i(this,void 0,void 0,function*(){return!!(null===(e=q(this.sessionKey,O.APTOS))||void 0===e?void 0:e.length)})}signTransaction(e){var t;return i(this,void 0,void 0,function*(){if(this.existedSDK)return this.existedSDK.signTransaction(e);if((yield this.isConnected())||(yield this.connect()),!(null===(t=q(this.sessionKey,O.APTOS))||void 0===t?void 0:t.length))throw Error("Fail to get account");throw Error("signTransaction method not supported.")})}disconnect(){var e;return i(this,void 0,void 0,function*(){if(this.existedSDK){yield this.existedSDK.disconnect();return}V(this.sessionKey,O.APTOS),null===(e=this.eventListeners)||void 0===e||e.disconnect.forEach(e=>e({code:4900,message:"Wallet disconnected"}))})}signAndSubmitTransaction(e,t={}){var r,n;return i(this,void 0,void 0,function*(){if(this.existedSDK)return this.existedSDK.signAndSubmitTransaction(e,t);if((yield this.isConnected())||(yield this.connect()),!(null===(r=q(this.sessionKey,O.APTOS))||void 0===r?void 0:r.length))throw Error("Fail to get account");let i=(null===(n=K(this.sessionKey))||void 0===n?void 0:n.code)||"",{authorizationId:o}=yield fetch(`${this.server}/api/aptos/authz`,{method:"POST",headers:{"Content-Type":"application/json","Blocto-Application-Identifier":this.appId,"Blocto-Session-Identifier":i},body:JSON.stringify(Object.assign(Object.assign({},e),t))}).then(e=>G(e,this.sessionKey));if("undefined"==typeof window)throw Error("Currently only supported in browser");let s=y(`${this.server}/${this.appId}/aptos/authz/${o}`);return m(s),new Promise((e,t)=>D("message",(r,i)=>{r.origin===this.server&&"APTOS:FRAME:RESPONSE"===r.data.type&&("APPROVED"===r.data.status&&(i(),b(s),e({hash:r.data.txHash})),"DECLINED"===r.data.status&&(i(),b(s),"incorrect_session_id"===r.data.errorCode&&this.disconnect(),t(Error(r.data.errorMessage))))}))})}signMessage(e){var t,r;return i(this,void 0,void 0,function*(){let i=tc(e);if(this.existedSDK)return this.existedSDK.signMessage(i);if((yield this.isConnected())||(yield this.connect()),!(null===(t=q(this.sessionKey,O.APTOS))||void 0===t?void 0:t.length))throw Error("Fail to get account");if("undefined"==typeof window)throw Error("Currently only supported in browser");let n=(null===(r=K(this.sessionKey))||void 0===r?void 0:r.code)||"",{signatureId:o}=yield fetch(`${this.server}/api/aptos/user-signature`,{method:"POST",headers:{"Content-Type":"application/json","Blocto-Application-Identifier":this.appId,"Blocto-Session-Identifier":n},body:JSON.stringify(i)}).then(e=>G(e,this.sessionKey)),s=y(`${this.server}/${this.appId}/aptos/user-signature/${o}`);return m(s),new Promise((e,t)=>
1D("message",(r,i)=>{r.origin===this.server&&"APTOS:FRAME:RESPONSE"===r.data.type&&("APPROVED"===r.data.status&&(i(),b(s),e(r.data)),"DECLINED"===r.data.status&&(i(),b(s),"incorrect_session_id"===r.data.errorCode&&this.disconnect(),t(Error(r.data.errorMessage))))}))})}connect(){return i(this,void 0,void 0,function*(){return new Promise(this.existedSDK?(e,t)=>setTimeout(()=>this.existedSDK.connect().then(e).catch(t),10):(e,t)=>{var r,n;if("undefined"==typeof window)return t("Currently only supported in browser");if(null===(r=q(this.sessionKey,O.APTOS))||void 0===r?void 0:r.length)return e({address:(null===(n=q(this.sessionKey,O.APTOS))||void 0===n?void 0:n[0])||null,publicKey:this.publicKey,authKey:null,minKeysRequired:2});let o=encodeURIComponent(window.location.origin),s=y(`${this.server}/${this.appId}/aptos/authn?l6n=${o}&v=${v}}`);m(s),D("message",(r,n)=>i(this,void 0,void 0,function*(){var i,o,a,u;if(r.origin===this.server){if("APTOS:FRAME:RESPONSE"===r.data.type){if(n(),b(s),$(this.sessionKey,{code:r.data.code,accounts:{[O.APTOS]:[r.data.addr]}},r.data.exp),(null===(i=r.data)||void 0===i?void 0:i.isAccountChanged)&&postMessage({originChain:O.APTOS,type:"BLOCTO_SDK:ACCOUNT_CHANGED"}),D("message",(e,t)=>{var r,i;(null===(r=e.data)||void 0===r?void 0:r.type)==="BLOCTO_SDK:ACCOUNT_CHANGED"&&(null===(i=e.data)||void 0===i?void 0:i.originChain)!==O.APTOS&&(this.disconnect(),t())}),null===(o=q(this.sessionKey,O.APTOS))||void 0===o||!o.length)return t();try{let{public_keys:t}=yield fetch(`${this.server}/blocto/aptos/accounts/${null===(a=q(this.sessionKey,O.APTOS))||void 0===a?void 0:a[0]}`).then(e=>e.json());this.publicKey=t||[],e({address:(null===(u=q(this.sessionKey,O.APTOS))||void 0===u?void 0:u[0])||"",publicKey:this.publicKey,authKey:null,minKeysRequired:2})}catch(e){return t(r)}}"APTOS:FRAME:CLOSE"===r.data.type&&(n(),b(s),t(Error("User declined the login request")))}}))})})}fetchAddress(){var e;return i(this,void 0,void 0,function*(){let t=(null===(e=K(this.sessionKey))||void 0===e?void 0:e.code)||"",{accounts:r}=yield fetch(`${this.server}/api/aptos/accounts`,{headers:{"Blocto-Application-Identifier":this.appId,"Blocto-Session-Identifier":t}}).then(e=>G(e,this.sessionKey));return Y(this.sessionKey,O.APTOS,r),(null==r?void 0:r[0])||""})}on(e,t){this.existedSDK&&this.existedSDK.on(e,t),super.on(e,t)}removeListener(e,t){this.existedSDK&&this.existedSDK.off(e,t),super.removeListener(e,t)}}class tf{constructor({appId:e,ethereum:t,aptos:r}){t&&(this.ethereum=new tl(Object.assign(Object.assign({}
1,t),{appId:e}))),r&&(this.aptos=new td(Object.assign(Object.assign({},r),{appId:e})))}}}}]);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.