@skip-go/widget-web-component 3.0.23 → 3.1.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/133.index.js +2 -0
- package/build/133.index.js.LICENSE.txt +17 -0
- package/build/278.index.js +1 -0
- package/build/324.index.js +1 -1
- package/build/394.index.js +1 -1
- package/build/431.index.js +1 -1
- package/build/48.index.js +64 -0
- package/build/484.index.js +1 -0
- package/build/544.index.js +1 -1
- package/build/552.index.js +10544 -0
- package/build/552.index.js.LICENSE.txt +23 -0
- package/build/557.index.js +1 -1
- package/build/590.index.js +1 -1
- package/build/613.index.js +134 -0
- package/build/700.index.js +0 -0
- package/build/701.index.js +0 -0
- package/build/833.index.js +2 -0
- package/build/833.index.js.LICENSE.txt +23 -0
- package/build/838.index.js +1 -1
- package/build/838.index.js.LICENSE.txt +0 -0
- package/build/996.index.js +1 -1
- package/build/index.d.ts +1 -1
- package/build/index.js +186 -100
- package/build/index.js.LICENSE.txt +9 -0
- package/package.json +1 -1
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2017 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* @license
|
|
9
|
+
* Copyright 2018 Google LLC
|
|
10
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* @license
|
|
15
|
+
* Copyright 2019 Google LLC
|
|
16
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* @license
|
|
21
|
+
* Copyright 2020 Google LLC
|
|
22
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
23
|
+
*/
|
package/build/557.index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const id=557;export const ids=[557];export const modules={24557:(e,t,n)=>{n.r(t),n.d(t,{StandardSolflareMetaMaskWalletAccount:()=>S,default:()=>z});var i=n(55873),r=n(27429),s=n(21640),o=n.n(s),a=n(52964);function c(e){return void 0===e.version;}function d(e){return c(e)?e.serialize({verifySignatures:!1,requireAllSignatures:!1}):e.serialize();}n(1048).Buffer;var l=function(e,t,n,i){return new(n||(n=Promise))((function(r,s){function o(e){try{c(i.next(e));}catch(e){s(e);}}function a(e){try{c(i.throw(e));}catch(e){s(e);}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t);}))).then(o,a);}c((i=i.apply(e,t||[])).next());}));};function h(e){return l(this,void 0,void 0,(function*(){try{return yield e.request({method:"wallet_getSnaps"}),!0;}catch(e){return!1;}}));}var u=n(63957),f=n(52218),m=n(90465);const g=["solana:mainnet","solana:devnet","solana:testnet","solana:localnet"];function v(e){return g.includes(e);}var p,w,_,y,b,E,A=function(e,t,n,i){if("a"===n&&!i)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?i:"a"===n?i.call(e):i?i.value:t.get(e);},M=function(e,t,n,i,r){if("m"===i)throw new TypeError("Private method is not writable");if("a"===i&&!r)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===i?r.call(e,n):r?r.value=n:t.set(e,n),n;};const x=g,K=[u.R,f.q,m.F];class S{get address(){return A(this,p,"f");}get publicKey(){return A(this,w,"f").slice();}get chains(){return A(this,_,"f").slice();}get features(){return A(this,y,"f").slice();}get label(){return A(this,b,"f");}get icon(){return A(this,E,"f");}constructor({address:e,publicKey:t,label:n,icon:i}){p.set(this,void 0),w.set(this,void 0),_.set(this,void 0),y.set(this,void 0),b.set(this,void 0),E.set(this,void 0),new.target===S&&Object.freeze(this),M(this,p,e,"f"),M(this,w,t,"f"),M(this,_,x,"f"),M(this,y,K,"f"),M(this,b,n,"f"),M(this,E,i,"f");}}p=new WeakMap,w=new WeakMap,_=new WeakMap,y=new WeakMap,b=new WeakMap,E=new WeakMap;var T=function(e,t,n,i){return new(n||(n=Promise))((function(r,s){function o(e){try{c(i.next(e));}catch(e){s(e);}}function a(e){try{c(i.throw(e));}catch(e){s(e);}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t);}))).then(o,a);}c((i=i.apply(e,t||[])).next());}));};class C extends r.A{constructor(e){super(),this._network="mainnet-beta",this._iframeParams={},this._element=null,this._iframe=null,this._publicKey=null,this._account=null,this._isConnected=!1,this._connectHandler=null,this._messageHandlers={},this._handleEvent=e=>{var t,n;switch(e.type){case"connect":return this._collapseIframe(),void((null===(t=e.data)||void 0===t?void 0:t.publicKey)?(this._publicKey=e.data.publicKey,this._isConnected=!0,this._connectHandler&&(this._connectHandler.resolve(),this._connectHandler=null),this._connected()):(this._connectHandler&&(this._connectHandler.reject(),this._connectHandler=null),this._disconnected()));case"disconnect":return this._connectHandler&&(this._connectHandler.reject(),this._connectHandler=null),void this._disconnected();case"accountChanged":return void((null===(n=e.data)||void 0===n?void 0:n.publicKey)?(this._publicKey=e.data.publicKey,this.emit("accountChanged",this.publicKey),this._standardConnected()):(this.emit("accountChanged",void 0),this._standardDisconnected()));default:return;}},this._handleResize=e=>{"full"===e.resizeMode?"fullscreen"===e.params.mode?this._expandIframe():"hide"===e.params.mode&&this._collapseIframe():"coordinates"===e.resizeMode&&this._resizeIframe(e.params);},this._handleMessage=e=>{var t;if("solflareIframeToWalletAdapter"!==(null===(t=e.data)||void 0===t?void 0:t.channel))return;const n=e.data.data||{};if("event"===n.type)this._handleEvent(n.event);else if("resize"===n.type)this._handleResize(n);else if("response"===n.type&&this._messageHandlers[n.id]){const{resolve:e,reject:t}=this._messageHandlers[n.id];delete this._messageHandlers[n.id],n.error?t(n.error):e(n.result);}},this._removeElement=()=>{this._element&&(this._element.remove(),this._element=null);},this._removeDanglingElements=()=>{const e=document.getElementsByClassName("solflare-metamask-wallet-adapter-iframe");for(const t of e)t.parentElement&&t.remove();},this._injectElement=()=>{this._removeElement(),this._removeDanglingElements();const e=Object.assign(Object.assign({},this._iframeParams),{mm:!0,v:1,cluster:this._network||"mainnet-beta",origin:window.location.origin||"",title:document.title||""}),t=Object.keys(e).map((t=>`${t}=${encodeURIComponent(e[t])}`)).join("&"),n=`${C.IFRAME_URL}?${t}`;this._element=document.createElement("div"),this._element.className="solflare-metamask-wallet-adapter-iframe",this._element.innerHTML=`\n <iframe src='${n}' style='position: fixed; top: 0; bottom: 0; left: 0; right: 0; width: 100%; height: 100%; border: none; border-radius: 0; z-index: 99999; color-scheme: auto;' allowtransparency='true'></iframe>\n `,document.body.appendChild(this._element),this._iframe=this._element.querySelector("iframe"),window.addEventListener("message",this._handleMessage,!1);},this._collapseIframe=()=>{this._iframe&&(this._iframe.style.top="",this._iframe.style.right="",this._iframe.style.height="2px",this._iframe.style.width="2px");},this._expandIframe=()=>{this._iframe&&(this._iframe.style.top="0px",this._iframe.style.bottom="0px",this._iframe.style.left="0px",this._iframe.style.right="0px",this._iframe.style.width="100%",this._iframe.style.height="100%");},this._resizeIframe=e=>{this._iframe&&(this._iframe.style.top=isFinite(e.top)?`${e.top}px`:"",this._iframe.style.bottom=isFinite(e.bottom)?`${e.bottom}px`:"",this._iframe.style.left=isFinite(e.left)?`${e.left}px`:"",this._iframe.style.right=isFinite(e.right)?`${e.right}px`:"",this._iframe.style.width=isFinite(e.width)?`${e.width}px`:e.width,this._iframe.style.height=isFinite(e.height)?`${e.height}px`:e.height);},this._sendIframeMessage=e=>{if(!this.connected||!this.publicKey)throw new Error("Wallet not connected");return new Promise(((t,n)=>{var i,r;const s=(0,a.A)();this._messageHandlers[s]={resolve:t,reject:n},null===(r=null===(i=this._iframe)||void 0===i?void 0:i.contentWindow)||void 0===r||r.postMessage({channel:"solflareWalletAdapterToIframe",data:Object.assign({id:s},e)},"*");}));},this._connected=()=>{this._isConnected=!0,this.emit("connect",this.publicKey),this._standardConnected();},this._disconnected=()=>{this._publicKey=null,this._isConnected=!1,window.removeEventListener("message",this._handleMessage,!1),this._removeElement(),this.emit("disconnect"),this._standardDisconnected();},this._standardConnected=()=>{if(!this.publicKey)return;const e=this.publicKey.toString();this._account&&this._account.address===e||(this._account=new S({address:e,publicKey:this.publicKey.toBytes()}),this.emit("standard_change",{accounts:this.standardAccounts}));},this._standardDisconnected=()=>{this._account&&(this._account=null,this.emit("standard_change",{accounts:this.standardAccounts}));},(null==e?void 0:e.network)&&(this._network=null==e?void 0:e.network),window.SolflareMetaMaskParams&&(this._iframeParams=Object.assign(Object.assign({},this._iframeParams),window.SolflareMetaMaskParams)),(null==e?void 0:e.params)&&(this._iframeParams=Object.assign(Object.assign({},this._iframeParams),null==e?void 0:e.params));}get publicKey(){return this._publicKey?new i.J3(this._publicKey):null;}get standardAccount(){return this._account;}get standardAccounts(){return this._account?[this._account]:[];}get isConnected(){return this._isConnected;}get connected(){return this.isConnected;}get autoApprove(){return!1;}connect(){return T(this,void 0,void 0,(function*(){this.connected||(this._injectElement(),yield new Promise(((e,t)=>{this._connectHandler={resolve:e,reject:t};})));}));}disconnect(){return T(this,void 0,void 0,(function*(){yield this._sendIframeMessage({method:"disconnect"}),this._disconnected();}));}signTransaction(e){var t;return T(this,void 0,void 0,(function*(){if(!this.connected||!this.publicKey)throw new Error("Wallet not connected");try{const t=d(e),n=yield this._sendIframeMessage({method:"signTransactionV2",params:{transaction:o().encode(t)}}),{transaction:r}=n;return c(e)?i.ZX.from(o().decode(r)):i.Kt.deserialize(o().decode(r));}catch(e){throw new Error((null===(t=null==e?void 0:e.toString)||void 0===t?void 0:t.call(e))||"Failed to sign transaction");}}));}signAllTransactions(e){var t;return T(this,void 0,void 0,(function*(){if(!this.connected||!this.publicKey)throw new Error("Wallet not connected");try{const t=e.map((e=>d(e))),{transactions:n}=yield this._sendIframeMessage({method:"signAllTransactionsV2",params:{transactions:t.map((e=>o().encode(e)))}});return n.map(((t,n)=>c(e[n])?i.ZX.from(o().decode(t)):i.Kt.deserialize(o().decode(t))));}catch(e){throw new Error((null===(t=null==e?void 0:e.toString)||void 0===t?void 0:t.call(e))||"Failed to sign transactions");}}));}signAndSendTransaction(e,t){var n;return T(this,void 0,void 0,(function*(){if(!this.connected||!this.publicKey)throw new Error("Wallet not connected");try{const n=d(e),{signature:i}=yield this._sendIframeMessage({method:"signAndSendTransaction",params:{transaction:o().encode(n),options:t}});return i;}catch(e){throw new Error((null===(n=null==e?void 0:e.toString)||void 0===n?void 0:n.call(e))||"Failed to sign and send transaction");}}));}signMessage(e,t="utf8"){var n;return T(this,void 0,void 0,(function*(){if(!this.connected||!this.publicKey)throw new Error("Wallet not connected");try{const{signature:n}=yield this._sendIframeMessage({method:"signMessage",params:{data:o().encode(e),display:t}});return Uint8Array.from(o().decode(n));}catch(e){throw new Error((null===(n=null==e?void 0:e.toString)||void 0===n?void 0:n.call(e))||"Failed to sign message");}}));}sign(e,t="utf8"){return T(this,void 0,void 0,(function*(){return yield this.signMessage(e,t);}));}static isSupported(){return T(this,void 0,void 0,(function*(){return!!(yield function(){return l(this,void 0,void 0,(function*(){try{const e=window.ethereum;if(!e)return null;if(e.providers&&Array.isArray(e.providers)){const t=e.providers;for(const e of t)if(yield h(e))return e;}if(e.detected&&Array.isArray(e.detected)){const t=e.detected;for(const e of t)if(yield h(e))return e;}return(yield h(e))?e:null;}catch(e){return console.error(e),null;}}));}());}));}standardSignAndSendTransaction(...e){return T(this,void 0,void 0,(function*(){if(!this.connected)throw new Error("not connected");const t=[];if(1===e.length){const{transaction:n,account:r,chain:s,options:a}=e[0],{minContextSlot:c,preflightCommitment:d,skipPreflight:l,maxRetries:h}=a||{};if(r!==this._account)throw new Error("invalid account");if(!v(s))throw new Error("invalid chain");const u=yield this.signAndSendTransaction(i.Kt.deserialize(n),{preflightCommitment:d,minContextSlot:c,maxRetries:h,skipPreflight:l});t.push({signature:o().decode(u)});}else if(e.length>1)for(const n of e)t.push(...yield this.standardSignAndSendTransaction(n));return t;}));}standardSignTransaction(...e){return T(this,void 0,void 0,(function*(){if(!this.connected)throw new Error("not connected");const t=[];if(1===e.length){const{transaction:n,account:r,chain:s}=e[0];if(r!==this._account)throw new Error("invalid account");if(s&&!v(s))throw new Error("invalid chain");const o=yield this.signTransaction(i.Kt.deserialize(n));t.push({signedTransaction:o.serialize()});}else if(e.length>1){let n;for(const t of e){if(t.account!==this._account)throw new Error("invalid account");if(t.chain){if(!v(t.chain))throw new Error("invalid chain");if(n){if(t.chain!==n)throw new Error("conflicting chain");}else n=t.chain;}}const r=e.map((({transaction:e})=>i.Kt.deserialize(e))),s=yield this.signAllTransactions(r);t.push(...s.map((e=>({signedTransaction:e.serialize()}))));}return t;}));}standardSignMessage(...e){return T(this,void 0,void 0,(function*(){if(!this.connected)throw new Error("not connected");const t=[];if(1===e.length){const{message:n,account:i}=e[0];if(i!==this._account)throw new Error("invalid account");const r=yield this.signMessage(n);t.push({signedMessage:n,signature:r});}else if(e.length>1)for(const n of e)t.push(...yield this.standardSignMessage(n));return t;}));}}C.IFRAME_URL="https://widget.solflare.com/";const z=C;},21640:(e,t,n)=>{const i=n(95364);e.exports=i("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz");},95364:e=>{e.exports=function(e){if(e.length>=255)throw new TypeError("Alphabet too long");for(var t=new Uint8Array(256),n=0;n<t.length;n++)t[n]=255;for(var i=0;i<e.length;i++){var r=e.charAt(i),s=r.charCodeAt(0);if(255!==t[s])throw new TypeError(r+" is ambiguous");t[s]=i;}var o=e.length,a=e.charAt(0),c=Math.log(o)/Math.log(256),d=Math.log(256)/Math.log(o);function l(e){if("string"!=typeof e)throw new TypeError("Expected String");if(0===e.length)return new Uint8Array;for(var n=0,i=0,r=0;e[n]===a;)i++,n++;for(var s=(e.length-n)*c+1>>>0,d=new Uint8Array(s);e[n];){var l=t[e.charCodeAt(n)];if(255===l)return;for(var h=0,u=s-1;(0!==l||h<r)&&-1!==u;u--,h++)l+=o*d[u]>>>0,d[u]=l%256>>>0,l=l/256>>>0;if(0!==l)throw new Error("Non-zero carry");r=h,n++;}for(var f=s-r;f!==s&&0===d[f];)f++;for(var m=new Uint8Array(i+(s-f)),g=i;f!==s;)m[g++]=d[f++];return m;}return{encode:function(t){if(t instanceof Uint8Array||(ArrayBuffer.isView(t)?t=new Uint8Array(t.buffer,t.byteOffset,t.byteLength):Array.isArray(t)&&(t=Uint8Array.from(t))),!(t instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(0===t.length)return"";for(var n=0,i=0,r=0,s=t.length;r!==s&&0===t[r];)r++,n++;for(var c=(s-r)*d+1>>>0,l=new Uint8Array(c);r!==s;){for(var h=t[r],u=0,f=c-1;(0!==h||u<i)&&-1!==f;f--,u++)h+=256*l[f]>>>0,l[f]=h%o>>>0,h=h/o>>>0;if(0!==h)throw new Error("Non-zero carry");i=u,r++;}for(var m=c-i;m!==c&&0===l[m];)m++;for(var g=a.repeat(n);m<c;++m)g+=e.charAt(l[m]);return g;},decodeUnsafe:l,decode:function(e){var t=l(e);if(t)return t;throw new Error("Non-base"+o+" character");}};};}};
|
|
1
|
+
export const id=557;export const ids=[557];export const modules={24557:(e,t,n)=>{n.r(t),n.d(t,{StandardSolflareMetaMaskWalletAccount:()=>S,default:()=>z});var i=n(98292),r=n(27429),s=n(21640),o=n.n(s),a=n(52964);function c(e){return void 0===e.version}function d(e){return c(e)?e.serialize({verifySignatures:!1,requireAllSignatures:!1}):e.serialize()}n(1048).Buffer;var l=function(e,t,n,i){return new(n||(n=Promise))((function(r,s){function o(e){try{c(i.next(e))}catch(e){s(e)}}function a(e){try{c(i.throw(e))}catch(e){s(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(o,a)}c((i=i.apply(e,t||[])).next())}))};function h(e){return l(this,void 0,void 0,(function*(){try{return yield e.request({method:"wallet_getSnaps"}),!0}catch(e){return!1}}))}var u=n(63957),f=n(52218),m=n(90465);const g=["solana:mainnet","solana:devnet","solana:testnet","solana:localnet"];function v(e){return g.includes(e)}var p,w,_,y,b,E,A=function(e,t,n,i){if("a"===n&&!i)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?i:"a"===n?i.call(e):i?i.value:t.get(e)},M=function(e,t,n,i,r){if("m"===i)throw new TypeError("Private method is not writable");if("a"===i&&!r)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===i?r.call(e,n):r?r.value=n:t.set(e,n),n};const x=g,K=[u.R,f.q,m.F];class S{get address(){return A(this,p,"f")}get publicKey(){return A(this,w,"f").slice()}get chains(){return A(this,_,"f").slice()}get features(){return A(this,y,"f").slice()}get label(){return A(this,b,"f")}get icon(){return A(this,E,"f")}constructor({address:e,publicKey:t,label:n,icon:i}){p.set(this,void 0),w.set(this,void 0),_.set(this,void 0),y.set(this,void 0),b.set(this,void 0),E.set(this,void 0),new.target===S&&Object.freeze(this),M(this,p,e,"f"),M(this,w,t,"f"),M(this,_,x,"f"),M(this,y,K,"f"),M(this,b,n,"f"),M(this,E,i,"f")}}p=new WeakMap,w=new WeakMap,_=new WeakMap,y=new WeakMap,b=new WeakMap,E=new WeakMap;var T=function(e,t,n,i){return new(n||(n=Promise))((function(r,s){function o(e){try{c(i.next(e))}catch(e){s(e)}}function a(e){try{c(i.throw(e))}catch(e){s(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(o,a)}c((i=i.apply(e,t||[])).next())}))};class C extends r.A{constructor(e){super(),this._network="mainnet-beta",this._iframeParams={},this._element=null,this._iframe=null,this._publicKey=null,this._account=null,this._isConnected=!1,this._connectHandler=null,this._messageHandlers={},this._handleEvent=e=>{var t,n;switch(e.type){case"connect":return this._collapseIframe(),void((null===(t=e.data)||void 0===t?void 0:t.publicKey)?(this._publicKey=e.data.publicKey,this._isConnected=!0,this._connectHandler&&(this._connectHandler.resolve(),this._connectHandler=null),this._connected()):(this._connectHandler&&(this._connectHandler.reject(),this._connectHandler=null),this._disconnected()));case"disconnect":return this._connectHandler&&(this._connectHandler.reject(),this._connectHandler=null),void this._disconnected();case"accountChanged":return void((null===(n=e.data)||void 0===n?void 0:n.publicKey)?(this._publicKey=e.data.publicKey,this.emit("accountChanged",this.publicKey),this._standardConnected()):(this.emit("accountChanged",void 0),this._standardDisconnected()));default:return}},this._handleResize=e=>{"full"===e.resizeMode?"fullscreen"===e.params.mode?this._expandIframe():"hide"===e.params.mode&&this._collapseIframe():"coordinates"===e.resizeMode&&this._resizeIframe(e.params)},this._handleMessage=e=>{var t;if("solflareIframeToWalletAdapter"!==(null===(t=e.data)||void 0===t?void 0:t.channel))return;const n=e.data.data||{};if("event"===n.type)this._handleEvent(n.event);else if("resize"===n.type)this._handleResize(n);else if("response"===n.type&&this._messageHandlers[n.id]){const{resolve:e,reject:t}=this._messageHandlers[n.id];delete this._messageHandlers[n.id],n.error?t(n.error):e(n.result)}},this._removeElement=()=>{this._element&&(this._element.remove(),this._element=null)},this._removeDanglingElements=()=>{const e=document.getElementsByClassName("solflare-metamask-wallet-adapter-iframe");for(const t of e)t.parentElement&&t.remove()},this._injectElement=()=>{this._removeElement(),this._removeDanglingElements();const e=Object.assign(Object.assign({},this._iframeParams),{mm:!0,v:1,cluster:this._network||"mainnet-beta",origin:window.location.origin||"",title:document.title||""}),t=Object.keys(e).map((t=>`${t}=${encodeURIComponent(e[t])}`)).join("&"),n=`${C.IFRAME_URL}?${t}`;this._element=document.createElement("div"),this._element.className="solflare-metamask-wallet-adapter-iframe",this._element.innerHTML=`\n <iframe src='${n}' style='position: fixed; top: 0; bottom: 0; left: 0; right: 0; width: 100%; height: 100%; border: none; border-radius: 0; z-index: 99999; color-scheme: auto;' allowtransparency='true'></iframe>\n `,document.body.appendChild(this._element),this._iframe=this._element.querySelector("iframe"),window.addEventListener("message",this._handleMessage,!1)},this._collapseIframe=()=>{this._iframe&&(this._iframe.style.top="",this._iframe.style.right="",this._iframe.style.height="2px",this._iframe.style.width="2px")},this._expandIframe=()=>{this._iframe&&(this._iframe.style.top="0px",this._iframe.style.bottom="0px",this._iframe.style.left="0px",this._iframe.style.right="0px",this._iframe.style.width="100%",this._iframe.style.height="100%")},this._resizeIframe=e=>{this._iframe&&(this._iframe.style.top=isFinite(e.top)?`${e.top}px`:"",this._iframe.style.bottom=isFinite(e.bottom)?`${e.bottom}px`:"",this._iframe.style.left=isFinite(e.left)?`${e.left}px`:"",this._iframe.style.right=isFinite(e.right)?`${e.right}px`:"",this._iframe.style.width=isFinite(e.width)?`${e.width}px`:e.width,this._iframe.style.height=isFinite(e.height)?`${e.height}px`:e.height)},this._sendIframeMessage=e=>{if(!this.connected||!this.publicKey)throw new Error("Wallet not connected");return new Promise(((t,n)=>{var i,r;const s=(0,a.A)();this._messageHandlers[s]={resolve:t,reject:n},null===(r=null===(i=this._iframe)||void 0===i?void 0:i.contentWindow)||void 0===r||r.postMessage({channel:"solflareWalletAdapterToIframe",data:Object.assign({id:s},e)},"*")}))},this._connected=()=>{this._isConnected=!0,this.emit("connect",this.publicKey),this._standardConnected()},this._disconnected=()=>{this._publicKey=null,this._isConnected=!1,window.removeEventListener("message",this._handleMessage,!1),this._removeElement(),this.emit("disconnect"),this._standardDisconnected()},this._standardConnected=()=>{if(!this.publicKey)return;const e=this.publicKey.toString();this._account&&this._account.address===e||(this._account=new S({address:e,publicKey:this.publicKey.toBytes()}),this.emit("standard_change",{accounts:this.standardAccounts}))},this._standardDisconnected=()=>{this._account&&(this._account=null,this.emit("standard_change",{accounts:this.standardAccounts}))},(null==e?void 0:e.network)&&(this._network=null==e?void 0:e.network),window.SolflareMetaMaskParams&&(this._iframeParams=Object.assign(Object.assign({},this._iframeParams),window.SolflareMetaMaskParams)),(null==e?void 0:e.params)&&(this._iframeParams=Object.assign(Object.assign({},this._iframeParams),null==e?void 0:e.params))}get publicKey(){return this._publicKey?new i.J3(this._publicKey):null}get standardAccount(){return this._account}get standardAccounts(){return this._account?[this._account]:[]}get isConnected(){return this._isConnected}get connected(){return this.isConnected}get autoApprove(){return!1}connect(){return T(this,void 0,void 0,(function*(){this.connected||(this._injectElement(),yield new Promise(((e,t)=>{this._connectHandler={resolve:e,reject:t}})))}))}disconnect(){return T(this,void 0,void 0,(function*(){yield this._sendIframeMessage({method:"disconnect"}),this._disconnected()}))}signTransaction(e){var t;return T(this,void 0,void 0,(function*(){if(!this.connected||!this.publicKey)throw new Error("Wallet not connected");try{const t=d(e),n=yield this._sendIframeMessage({method:"signTransactionV2",params:{transaction:o().encode(t)}}),{transaction:r}=n;return c(e)?i.ZX.from(o().decode(r)):i.Kt.deserialize(o().decode(r))}catch(e){throw new Error((null===(t=null==e?void 0:e.toString)||void 0===t?void 0:t.call(e))||"Failed to sign transaction")}}))}signAllTransactions(e){var t;return T(this,void 0,void 0,(function*(){if(!this.connected||!this.publicKey)throw new Error("Wallet not connected");try{const t=e.map((e=>d(e))),{transactions:n}=yield this._sendIframeMessage({method:"signAllTransactionsV2",params:{transactions:t.map((e=>o().encode(e)))}});return n.map(((t,n)=>c(e[n])?i.ZX.from(o().decode(t)):i.Kt.deserialize(o().decode(t))))}catch(e){throw new Error((null===(t=null==e?void 0:e.toString)||void 0===t?void 0:t.call(e))||"Failed to sign transactions")}}))}signAndSendTransaction(e,t){var n;return T(this,void 0,void 0,(function*(){if(!this.connected||!this.publicKey)throw new Error("Wallet not connected");try{const n=d(e),{signature:i}=yield this._sendIframeMessage({method:"signAndSendTransaction",params:{transaction:o().encode(n),options:t}});return i}catch(e){throw new Error((null===(n=null==e?void 0:e.toString)||void 0===n?void 0:n.call(e))||"Failed to sign and send transaction")}}))}signMessage(e,t="utf8"){var n;return T(this,void 0,void 0,(function*(){if(!this.connected||!this.publicKey)throw new Error("Wallet not connected");try{const{signature:n}=yield this._sendIframeMessage({method:"signMessage",params:{data:o().encode(e),display:t}});return Uint8Array.from(o().decode(n))}catch(e){throw new Error((null===(n=null==e?void 0:e.toString)||void 0===n?void 0:n.call(e))||"Failed to sign message")}}))}sign(e,t="utf8"){return T(this,void 0,void 0,(function*(){return yield this.signMessage(e,t)}))}static isSupported(){return T(this,void 0,void 0,(function*(){return!!(yield function(){return l(this,void 0,void 0,(function*(){try{const e=window.ethereum;if(!e)return null;if(e.providers&&Array.isArray(e.providers)){const t=e.providers;for(const e of t)if(yield h(e))return e}if(e.detected&&Array.isArray(e.detected)){const t=e.detected;for(const e of t)if(yield h(e))return e}return(yield h(e))?e:null}catch(e){return console.error(e),null}}))}())}))}standardSignAndSendTransaction(...e){return T(this,void 0,void 0,(function*(){if(!this.connected)throw new Error("not connected");const t=[];if(1===e.length){const{transaction:n,account:r,chain:s,options:a}=e[0],{minContextSlot:c,preflightCommitment:d,skipPreflight:l,maxRetries:h}=a||{};if(r!==this._account)throw new Error("invalid account");if(!v(s))throw new Error("invalid chain");const u=yield this.signAndSendTransaction(i.Kt.deserialize(n),{preflightCommitment:d,minContextSlot:c,maxRetries:h,skipPreflight:l});t.push({signature:o().decode(u)})}else if(e.length>1)for(const n of e)t.push(...yield this.standardSignAndSendTransaction(n));return t}))}standardSignTransaction(...e){return T(this,void 0,void 0,(function*(){if(!this.connected)throw new Error("not connected");const t=[];if(1===e.length){const{transaction:n,account:r,chain:s}=e[0];if(r!==this._account)throw new Error("invalid account");if(s&&!v(s))throw new Error("invalid chain");const o=yield this.signTransaction(i.Kt.deserialize(n));t.push({signedTransaction:o.serialize()})}else if(e.length>1){let n;for(const t of e){if(t.account!==this._account)throw new Error("invalid account");if(t.chain){if(!v(t.chain))throw new Error("invalid chain");if(n){if(t.chain!==n)throw new Error("conflicting chain")}else n=t.chain}}const r=e.map((({transaction:e})=>i.Kt.deserialize(e))),s=yield this.signAllTransactions(r);t.push(...s.map((e=>({signedTransaction:e.serialize()}))))}return t}))}standardSignMessage(...e){return T(this,void 0,void 0,(function*(){if(!this.connected)throw new Error("not connected");const t=[];if(1===e.length){const{message:n,account:i}=e[0];if(i!==this._account)throw new Error("invalid account");const r=yield this.signMessage(n);t.push({signedMessage:n,signature:r})}else if(e.length>1)for(const n of e)t.push(...yield this.standardSignMessage(n));return t}))}}C.IFRAME_URL="https://widget.solflare.com/";const z=C},21640:(e,t,n)=>{const i=n(95364);e.exports=i("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz")},95364:e=>{e.exports=function(e){if(e.length>=255)throw new TypeError("Alphabet too long");for(var t=new Uint8Array(256),n=0;n<t.length;n++)t[n]=255;for(var i=0;i<e.length;i++){var r=e.charAt(i),s=r.charCodeAt(0);if(255!==t[s])throw new TypeError(r+" is ambiguous");t[s]=i}var o=e.length,a=e.charAt(0),c=Math.log(o)/Math.log(256),d=Math.log(256)/Math.log(o);function l(e){if("string"!=typeof e)throw new TypeError("Expected String");if(0===e.length)return new Uint8Array;for(var n=0,i=0,r=0;e[n]===a;)i++,n++;for(var s=(e.length-n)*c+1>>>0,d=new Uint8Array(s);e[n];){var l=t[e.charCodeAt(n)];if(255===l)return;for(var h=0,u=s-1;(0!==l||h<r)&&-1!==u;u--,h++)l+=o*d[u]>>>0,d[u]=l%256>>>0,l=l/256>>>0;if(0!==l)throw new Error("Non-zero carry");r=h,n++}for(var f=s-r;f!==s&&0===d[f];)f++;for(var m=new Uint8Array(i+(s-f)),g=i;f!==s;)m[g++]=d[f++];return m}return{encode:function(t){if(t instanceof Uint8Array||(ArrayBuffer.isView(t)?t=new Uint8Array(t.buffer,t.byteOffset,t.byteLength):Array.isArray(t)&&(t=Uint8Array.from(t))),!(t instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(0===t.length)return"";for(var n=0,i=0,r=0,s=t.length;r!==s&&0===t[r];)r++,n++;for(var c=(s-r)*d+1>>>0,l=new Uint8Array(c);r!==s;){for(var h=t[r],u=0,f=c-1;(0!==h||u<i)&&-1!==f;f--,u++)h+=256*l[f]>>>0,l[f]=h%o>>>0,h=h/o>>>0;if(0!==h)throw new Error("Non-zero carry");i=u,r++}for(var m=c-i;m!==c&&0===l[m];)m++;for(var g=a.repeat(n);m<c;++m)g+=e.charAt(l[m]);return g},decodeUnsafe:l,decode:function(e){var t=l(e);if(t)return t;throw new Error("Non-base"+o+" character")}}}}};
|
package/build/590.index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const id=590;export const ids=[590];export const modules={91590:(e,t,n)=>{n.r(t),n.d(t,{StandardSolflareMetaMaskWalletAccount:()=>S,default:()=>z});var i=n(15661),r=n(27429),s=n(5117),o=n.n(s),a=n(52964);function c(e){return void 0===e.version}function d(e){return c(e)?e.serialize({verifySignatures:!1,requireAllSignatures:!1}):e.serialize()}n(1048).Buffer;var l=function(e,t,n,i){return new(n||(n=Promise))((function(r,s){function o(e){try{c(i.next(e))}catch(e){s(e)}}function a(e){try{c(i.throw(e))}catch(e){s(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(o,a)}c((i=i.apply(e,t||[])).next())}))};function h(e){return l(this,void 0,void 0,(function*(){try{return yield e.request({method:"wallet_getSnaps"}),!0}catch(e){return!1}}))}var u=n(63957),f=n(52218),m=n(90465);const g=["solana:mainnet","solana:devnet","solana:testnet","solana:localnet"];function v(e){return g.includes(e)}var p,w,_,y,b,E,A=function(e,t,n,i){if("a"===n&&!i)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?i:"a"===n?i.call(e):i?i.value:t.get(e)},M=function(e,t,n,i,r){if("m"===i)throw new TypeError("Private method is not writable");if("a"===i&&!r)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===i?r.call(e,n):r?r.value=n:t.set(e,n),n};const T=g,x=[u.R,f.q,m.F];class S{get address(){return A(this,p,"f")}get publicKey(){return A(this,w,"f").slice()}get chains(){return A(this,_,"f").slice()}get features(){return A(this,y,"f").slice()}get label(){return A(this,b,"f")}get icon(){return A(this,E,"f")}constructor({address:e,publicKey:t,label:n,icon:i}){p.set(this,void 0),w.set(this,void 0),_.set(this,void 0),y.set(this,void 0),b.set(this,void 0),E.set(this,void 0),new.target===S&&Object.freeze(this),M(this,p,e,"f"),M(this,w,t,"f"),M(this,_,T,"f"),M(this,y,x,"f"),M(this,b,n,"f"),M(this,E,i,"f")}}p=new WeakMap,w=new WeakMap,_=new WeakMap,y=new WeakMap,b=new WeakMap,E=new WeakMap;var K=function(e,t,n,i){return new(n||(n=Promise))((function(r,s){function o(e){try{c(i.next(e))}catch(e){s(e)}}function a(e){try{c(i.throw(e))}catch(e){s(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(o,a)}c((i=i.apply(e,t||[])).next())}))};class C extends r.A{constructor(e){super(),this._network="mainnet-beta",this._iframeParams={},this._element=null,this._iframe=null,this._publicKey=null,this._account=null,this._isConnected=!1,this._connectHandler=null,this._messageHandlers={},this._handleEvent=e=>{var t,n;switch(e.type){case"connect":return this._collapseIframe(),void((null===(t=e.data)||void 0===t?void 0:t.publicKey)?(this._publicKey=e.data.publicKey,this._isConnected=!0,this._connectHandler&&(this._connectHandler.resolve(),this._connectHandler=null),this._connected()):(this._connectHandler&&(this._connectHandler.reject(),this._connectHandler=null),this._disconnected()));case"disconnect":return this._connectHandler&&(this._connectHandler.reject(),this._connectHandler=null),void this._disconnected();case"accountChanged":return void((null===(n=e.data)||void 0===n?void 0:n.publicKey)?(this._publicKey=e.data.publicKey,this.emit("accountChanged",this.publicKey),this._standardConnected()):(this.emit("accountChanged",void 0),this._standardDisconnected()));default:return}},this._handleResize=e=>{"full"===e.resizeMode?"fullscreen"===e.params.mode?this._expandIframe():"hide"===e.params.mode&&this._collapseIframe():"coordinates"===e.resizeMode&&this._resizeIframe(e.params)},this._handleMessage=e=>{var t;if("solflareIframeToWalletAdapter"!==(null===(t=e.data)||void 0===t?void 0:t.channel))return;const n=e.data.data||{};if("event"===n.type)this._handleEvent(n.event);else if("resize"===n.type)this._handleResize(n);else if("response"===n.type&&this._messageHandlers[n.id]){const{resolve:e,reject:t}=this._messageHandlers[n.id];delete this._messageHandlers[n.id],n.error?t(n.error):e(n.result)}},this._removeElement=()=>{this._element&&(this._element.remove(),this._element=null)},this._removeDanglingElements=()=>{const e=document.getElementsByClassName("solflare-metamask-wallet-adapter-iframe");for(const t of e)t.parentElement&&t.remove()},this._injectElement=()=>{this._removeElement(),this._removeDanglingElements();const e=Object.assign(Object.assign({},this._iframeParams),{mm:!0,v:1,cluster:this._network||"mainnet-beta",origin:window.location.origin||"",title:document.title||""}),t=Object.keys(e).map((t=>`${t}=${encodeURIComponent(e[t])}`)).join("&"),n=`${C.IFRAME_URL}?${t}`;this._element=document.createElement("div"),this._element.className="solflare-metamask-wallet-adapter-iframe",this._element.innerHTML=`\n <iframe src='${n}' style='position: fixed; top: 0; bottom: 0; left: 0; right: 0; width: 100%; height: 100%; border: none; border-radius: 0; z-index: 99999; color-scheme: auto;' allowtransparency='true'></iframe>\n `,document.body.appendChild(this._element),this._iframe=this._element.querySelector("iframe"),window.addEventListener("message",this._handleMessage,!1)},this._collapseIframe=()=>{this._iframe&&(this._iframe.style.top="",this._iframe.style.right="",this._iframe.style.height="2px",this._iframe.style.width="2px")},this._expandIframe=()=>{this._iframe&&(this._iframe.style.top="0px",this._iframe.style.bottom="0px",this._iframe.style.left="0px",this._iframe.style.right="0px",this._iframe.style.width="100%",this._iframe.style.height="100%")},this._resizeIframe=e=>{this._iframe&&(this._iframe.style.top=isFinite(e.top)?`${e.top}px`:"",this._iframe.style.bottom=isFinite(e.bottom)?`${e.bottom}px`:"",this._iframe.style.left=isFinite(e.left)?`${e.left}px`:"",this._iframe.style.right=isFinite(e.right)?`${e.right}px`:"",this._iframe.style.width=isFinite(e.width)?`${e.width}px`:e.width,this._iframe.style.height=isFinite(e.height)?`${e.height}px`:e.height)},this._sendIframeMessage=e=>{if(!this.connected||!this.publicKey)throw new Error("Wallet not connected");return new Promise(((t,n)=>{var i,r;const s=(0,a.A)();this._messageHandlers[s]={resolve:t,reject:n},null===(r=null===(i=this._iframe)||void 0===i?void 0:i.contentWindow)||void 0===r||r.postMessage({channel:"solflareWalletAdapterToIframe",data:Object.assign({id:s},e)},"*")}))},this._connected=()=>{this._isConnected=!0,this.emit("connect",this.publicKey),this._standardConnected()},this._disconnected=()=>{this._publicKey=null,this._isConnected=!1,window.removeEventListener("message",this._handleMessage,!1),this._removeElement(),this.emit("disconnect"),this._standardDisconnected()},this._standardConnected=()=>{if(!this.publicKey)return;const e=this.publicKey.toString();this._account&&this._account.address===e||(this._account=new S({address:e,publicKey:this.publicKey.toBytes()}),this.emit("standard_change",{accounts:this.standardAccounts}))},this._standardDisconnected=()=>{this._account&&(this._account=null,this.emit("standard_change",{accounts:this.standardAccounts}))},(null==e?void 0:e.network)&&(this._network=null==e?void 0:e.network),window.SolflareMetaMaskParams&&(this._iframeParams=Object.assign(Object.assign({},this._iframeParams),window.SolflareMetaMaskParams)),(null==e?void 0:e.params)&&(this._iframeParams=Object.assign(Object.assign({},this._iframeParams),null==e?void 0:e.params))}get publicKey(){return this._publicKey?new i.PublicKey(this._publicKey):null}get standardAccount(){return this._account}get standardAccounts(){return this._account?[this._account]:[]}get isConnected(){return this._isConnected}get connected(){return this.isConnected}get autoApprove(){return!1}connect(){return K(this,void 0,void 0,(function*(){this.connected||(this._injectElement(),yield new Promise(((e,t)=>{this._connectHandler={resolve:e,reject:t}})))}))}disconnect(){return K(this,void 0,void 0,(function*(){yield this._sendIframeMessage({method:"disconnect"}),this._disconnected()}))}signTransaction(e){var t;return K(this,void 0,void 0,(function*(){if(!this.connected||!this.publicKey)throw new Error("Wallet not connected");try{const t=d(e),n=yield this._sendIframeMessage({method:"signTransactionV2",params:{transaction:o().encode(t)}}),{transaction:r}=n;return c(e)?i.Transaction.from(o().decode(r)):i.VersionedTransaction.deserialize(o().decode(r))}catch(e){throw new Error((null===(t=null==e?void 0:e.toString)||void 0===t?void 0:t.call(e))||"Failed to sign transaction")}}))}signAllTransactions(e){var t;return K(this,void 0,void 0,(function*(){if(!this.connected||!this.publicKey)throw new Error("Wallet not connected");try{const t=e.map((e=>d(e))),{transactions:n}=yield this._sendIframeMessage({method:"signAllTransactionsV2",params:{transactions:t.map((e=>o().encode(e)))}});return n.map(((t,n)=>c(e[n])?i.Transaction.from(o().decode(t)):i.VersionedTransaction.deserialize(o().decode(t))))}catch(e){throw new Error((null===(t=null==e?void 0:e.toString)||void 0===t?void 0:t.call(e))||"Failed to sign transactions")}}))}signAndSendTransaction(e,t){var n;return K(this,void 0,void 0,(function*(){if(!this.connected||!this.publicKey)throw new Error("Wallet not connected");try{const n=d(e),{signature:i}=yield this._sendIframeMessage({method:"signAndSendTransaction",params:{transaction:o().encode(n),options:t}});return i}catch(e){throw new Error((null===(n=null==e?void 0:e.toString)||void 0===n?void 0:n.call(e))||"Failed to sign and send transaction")}}))}signMessage(e,t="utf8"){var n;return K(this,void 0,void 0,(function*(){if(!this.connected||!this.publicKey)throw new Error("Wallet not connected");try{const{signature:n}=yield this._sendIframeMessage({method:"signMessage",params:{data:o().encode(e),display:t}});return Uint8Array.from(o().decode(n))}catch(e){throw new Error((null===(n=null==e?void 0:e.toString)||void 0===n?void 0:n.call(e))||"Failed to sign message")}}))}sign(e,t="utf8"){return K(this,void 0,void 0,(function*(){return yield this.signMessage(e,t)}))}static isSupported(){return K(this,void 0,void 0,(function*(){return!!(yield function(){return l(this,void 0,void 0,(function*(){try{const e=window.ethereum;if(!e)return null;if(e.providers&&Array.isArray(e.providers)){const t=e.providers;for(const e of t)if(yield h(e))return e}if(e.detected&&Array.isArray(e.detected)){const t=e.detected;for(const e of t)if(yield h(e))return e}return(yield h(e))?e:null}catch(e){return console.error(e),null}}))}())}))}standardSignAndSendTransaction(...e){return K(this,void 0,void 0,(function*(){if(!this.connected)throw new Error("not connected");const t=[];if(1===e.length){const{transaction:n,account:r,chain:s,options:a}=e[0],{minContextSlot:c,preflightCommitment:d,skipPreflight:l,maxRetries:h}=a||{};if(r!==this._account)throw new Error("invalid account");if(!v(s))throw new Error("invalid chain");const u=yield this.signAndSendTransaction(i.VersionedTransaction.deserialize(n),{preflightCommitment:d,minContextSlot:c,maxRetries:h,skipPreflight:l});t.push({signature:o().decode(u)})}else if(e.length>1)for(const n of e)t.push(...yield this.standardSignAndSendTransaction(n));return t}))}standardSignTransaction(...e){return K(this,void 0,void 0,(function*(){if(!this.connected)throw new Error("not connected");const t=[];if(1===e.length){const{transaction:n,account:r,chain:s}=e[0];if(r!==this._account)throw new Error("invalid account");if(s&&!v(s))throw new Error("invalid chain");const o=yield this.signTransaction(i.VersionedTransaction.deserialize(n));t.push({signedTransaction:o.serialize()})}else if(e.length>1){let n;for(const t of e){if(t.account!==this._account)throw new Error("invalid account");if(t.chain){if(!v(t.chain))throw new Error("invalid chain");if(n){if(t.chain!==n)throw new Error("conflicting chain")}else n=t.chain}}const r=e.map((({transaction:e})=>i.VersionedTransaction.deserialize(e))),s=yield this.signAllTransactions(r);t.push(...s.map((e=>({signedTransaction:e.serialize()}))))}return t}))}standardSignMessage(...e){return K(this,void 0,void 0,(function*(){if(!this.connected)throw new Error("not connected");const t=[];if(1===e.length){const{message:n,account:i}=e[0];if(i!==this._account)throw new Error("invalid account");const r=yield this.signMessage(n);t.push({signedMessage:n,signature:r})}else if(e.length>1)for(const n of e)t.push(...yield this.standardSignMessage(n));return t}))}}C.IFRAME_URL="https://widget.solflare.com/";const z=C},82582:e=>{e.exports=function(e){if(e.length>=255)throw new TypeError("Alphabet too long");for(var t=new Uint8Array(256),n=0;n<t.length;n++)t[n]=255;for(var i=0;i<e.length;i++){var r=e.charAt(i),s=r.charCodeAt(0);if(255!==t[s])throw new TypeError(r+" is ambiguous");t[s]=i}var o=e.length,a=e.charAt(0),c=Math.log(o)/Math.log(256),d=Math.log(256)/Math.log(o);function l(e){if("string"!=typeof e)throw new TypeError("Expected String");if(0===e.length)return new Uint8Array;for(var n=0,i=0,r=0;e[n]===a;)i++,n++;for(var s=(e.length-n)*c+1>>>0,d=new Uint8Array(s);e[n];){var l=t[e.charCodeAt(n)];if(255===l)return;for(var h=0,u=s-1;(0!==l||h<r)&&-1!==u;u--,h++)l+=o*d[u]>>>0,d[u]=l%256>>>0,l=l/256>>>0;if(0!==l)throw new Error("Non-zero carry");r=h,n++}for(var f=s-r;f!==s&&0===d[f];)f++;for(var m=new Uint8Array(i+(s-f)),g=i;f!==s;)m[g++]=d[f++];return m}return{encode:function(t){if(t instanceof Uint8Array||(ArrayBuffer.isView(t)?t=new Uint8Array(t.buffer,t.byteOffset,t.byteLength):Array.isArray(t)&&(t=Uint8Array.from(t))),!(t instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(0===t.length)return"";for(var n=0,i=0,r=0,s=t.length;r!==s&&0===t[r];)r++,n++;for(var c=(s-r)*d+1>>>0,l=new Uint8Array(c);r!==s;){for(var h=t[r],u=0,f=c-1;(0!==h||u<i)&&-1!==f;f--,u++)h+=256*l[f]>>>0,l[f]=h%o>>>0,h=h/o>>>0;if(0!==h)throw new Error("Non-zero carry");i=u,r++}for(var m=c-i;m!==c&&0===l[m];)m++;for(var g=a.repeat(n);m<c;++m)g+=e.charAt(l[m]);return g},decodeUnsafe:l,decode:function(e){var t=l(e);if(t)return t;throw new Error("Non-base"+o+" character")}}}},5117:(e,t,n)=>{const i=n(82582);e.exports=i("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz")}};
|
|
1
|
+
export const id=590;export const ids=[590];export const modules={91590:(e,t,n)=>{n.r(t),n.d(t,{StandardSolflareMetaMaskWalletAccount:()=>S,default:()=>z});var i=n(7081),r=n(27429),s=n(5117),o=n.n(s),a=n(52964);function c(e){return void 0===e.version}function d(e){return c(e)?e.serialize({verifySignatures:!1,requireAllSignatures:!1}):e.serialize()}n(1048).Buffer;var l=function(e,t,n,i){return new(n||(n=Promise))((function(r,s){function o(e){try{c(i.next(e))}catch(e){s(e)}}function a(e){try{c(i.throw(e))}catch(e){s(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(o,a)}c((i=i.apply(e,t||[])).next())}))};function h(e){return l(this,void 0,void 0,(function*(){try{return yield e.request({method:"wallet_getSnaps"}),!0}catch(e){return!1}}))}var u=n(63957),f=n(52218),m=n(90465);const g=["solana:mainnet","solana:devnet","solana:testnet","solana:localnet"];function v(e){return g.includes(e)}var p,w,_,y,b,E,A=function(e,t,n,i){if("a"===n&&!i)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?i:"a"===n?i.call(e):i?i.value:t.get(e)},M=function(e,t,n,i,r){if("m"===i)throw new TypeError("Private method is not writable");if("a"===i&&!r)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===i?r.call(e,n):r?r.value=n:t.set(e,n),n};const T=g,x=[u.R,f.q,m.F];class S{get address(){return A(this,p,"f")}get publicKey(){return A(this,w,"f").slice()}get chains(){return A(this,_,"f").slice()}get features(){return A(this,y,"f").slice()}get label(){return A(this,b,"f")}get icon(){return A(this,E,"f")}constructor({address:e,publicKey:t,label:n,icon:i}){p.set(this,void 0),w.set(this,void 0),_.set(this,void 0),y.set(this,void 0),b.set(this,void 0),E.set(this,void 0),new.target===S&&Object.freeze(this),M(this,p,e,"f"),M(this,w,t,"f"),M(this,_,T,"f"),M(this,y,x,"f"),M(this,b,n,"f"),M(this,E,i,"f")}}p=new WeakMap,w=new WeakMap,_=new WeakMap,y=new WeakMap,b=new WeakMap,E=new WeakMap;var K=function(e,t,n,i){return new(n||(n=Promise))((function(r,s){function o(e){try{c(i.next(e))}catch(e){s(e)}}function a(e){try{c(i.throw(e))}catch(e){s(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(o,a)}c((i=i.apply(e,t||[])).next())}))};class C extends r.A{constructor(e){super(),this._network="mainnet-beta",this._iframeParams={},this._element=null,this._iframe=null,this._publicKey=null,this._account=null,this._isConnected=!1,this._connectHandler=null,this._messageHandlers={},this._handleEvent=e=>{var t,n;switch(e.type){case"connect":return this._collapseIframe(),void((null===(t=e.data)||void 0===t?void 0:t.publicKey)?(this._publicKey=e.data.publicKey,this._isConnected=!0,this._connectHandler&&(this._connectHandler.resolve(),this._connectHandler=null),this._connected()):(this._connectHandler&&(this._connectHandler.reject(),this._connectHandler=null),this._disconnected()));case"disconnect":return this._connectHandler&&(this._connectHandler.reject(),this._connectHandler=null),void this._disconnected();case"accountChanged":return void((null===(n=e.data)||void 0===n?void 0:n.publicKey)?(this._publicKey=e.data.publicKey,this.emit("accountChanged",this.publicKey),this._standardConnected()):(this.emit("accountChanged",void 0),this._standardDisconnected()));default:return}},this._handleResize=e=>{"full"===e.resizeMode?"fullscreen"===e.params.mode?this._expandIframe():"hide"===e.params.mode&&this._collapseIframe():"coordinates"===e.resizeMode&&this._resizeIframe(e.params)},this._handleMessage=e=>{var t;if("solflareIframeToWalletAdapter"!==(null===(t=e.data)||void 0===t?void 0:t.channel))return;const n=e.data.data||{};if("event"===n.type)this._handleEvent(n.event);else if("resize"===n.type)this._handleResize(n);else if("response"===n.type&&this._messageHandlers[n.id]){const{resolve:e,reject:t}=this._messageHandlers[n.id];delete this._messageHandlers[n.id],n.error?t(n.error):e(n.result)}},this._removeElement=()=>{this._element&&(this._element.remove(),this._element=null)},this._removeDanglingElements=()=>{const e=document.getElementsByClassName("solflare-metamask-wallet-adapter-iframe");for(const t of e)t.parentElement&&t.remove()},this._injectElement=()=>{this._removeElement(),this._removeDanglingElements();const e=Object.assign(Object.assign({},this._iframeParams),{mm:!0,v:1,cluster:this._network||"mainnet-beta",origin:window.location.origin||"",title:document.title||""}),t=Object.keys(e).map((t=>`${t}=${encodeURIComponent(e[t])}`)).join("&"),n=`${C.IFRAME_URL}?${t}`;this._element=document.createElement("div"),this._element.className="solflare-metamask-wallet-adapter-iframe",this._element.innerHTML=`\n <iframe src='${n}' style='position: fixed; top: 0; bottom: 0; left: 0; right: 0; width: 100%; height: 100%; border: none; border-radius: 0; z-index: 99999; color-scheme: auto;' allowtransparency='true'></iframe>\n `,document.body.appendChild(this._element),this._iframe=this._element.querySelector("iframe"),window.addEventListener("message",this._handleMessage,!1)},this._collapseIframe=()=>{this._iframe&&(this._iframe.style.top="",this._iframe.style.right="",this._iframe.style.height="2px",this._iframe.style.width="2px")},this._expandIframe=()=>{this._iframe&&(this._iframe.style.top="0px",this._iframe.style.bottom="0px",this._iframe.style.left="0px",this._iframe.style.right="0px",this._iframe.style.width="100%",this._iframe.style.height="100%")},this._resizeIframe=e=>{this._iframe&&(this._iframe.style.top=isFinite(e.top)?`${e.top}px`:"",this._iframe.style.bottom=isFinite(e.bottom)?`${e.bottom}px`:"",this._iframe.style.left=isFinite(e.left)?`${e.left}px`:"",this._iframe.style.right=isFinite(e.right)?`${e.right}px`:"",this._iframe.style.width=isFinite(e.width)?`${e.width}px`:e.width,this._iframe.style.height=isFinite(e.height)?`${e.height}px`:e.height)},this._sendIframeMessage=e=>{if(!this.connected||!this.publicKey)throw new Error("Wallet not connected");return new Promise(((t,n)=>{var i,r;const s=(0,a.A)();this._messageHandlers[s]={resolve:t,reject:n},null===(r=null===(i=this._iframe)||void 0===i?void 0:i.contentWindow)||void 0===r||r.postMessage({channel:"solflareWalletAdapterToIframe",data:Object.assign({id:s},e)},"*")}))},this._connected=()=>{this._isConnected=!0,this.emit("connect",this.publicKey),this._standardConnected()},this._disconnected=()=>{this._publicKey=null,this._isConnected=!1,window.removeEventListener("message",this._handleMessage,!1),this._removeElement(),this.emit("disconnect"),this._standardDisconnected()},this._standardConnected=()=>{if(!this.publicKey)return;const e=this.publicKey.toString();this._account&&this._account.address===e||(this._account=new S({address:e,publicKey:this.publicKey.toBytes()}),this.emit("standard_change",{accounts:this.standardAccounts}))},this._standardDisconnected=()=>{this._account&&(this._account=null,this.emit("standard_change",{accounts:this.standardAccounts}))},(null==e?void 0:e.network)&&(this._network=null==e?void 0:e.network),window.SolflareMetaMaskParams&&(this._iframeParams=Object.assign(Object.assign({},this._iframeParams),window.SolflareMetaMaskParams)),(null==e?void 0:e.params)&&(this._iframeParams=Object.assign(Object.assign({},this._iframeParams),null==e?void 0:e.params))}get publicKey(){return this._publicKey?new i.PublicKey(this._publicKey):null}get standardAccount(){return this._account}get standardAccounts(){return this._account?[this._account]:[]}get isConnected(){return this._isConnected}get connected(){return this.isConnected}get autoApprove(){return!1}connect(){return K(this,void 0,void 0,(function*(){this.connected||(this._injectElement(),yield new Promise(((e,t)=>{this._connectHandler={resolve:e,reject:t}})))}))}disconnect(){return K(this,void 0,void 0,(function*(){yield this._sendIframeMessage({method:"disconnect"}),this._disconnected()}))}signTransaction(e){var t;return K(this,void 0,void 0,(function*(){if(!this.connected||!this.publicKey)throw new Error("Wallet not connected");try{const t=d(e),n=yield this._sendIframeMessage({method:"signTransactionV2",params:{transaction:o().encode(t)}}),{transaction:r}=n;return c(e)?i.Transaction.from(o().decode(r)):i.VersionedTransaction.deserialize(o().decode(r))}catch(e){throw new Error((null===(t=null==e?void 0:e.toString)||void 0===t?void 0:t.call(e))||"Failed to sign transaction")}}))}signAllTransactions(e){var t;return K(this,void 0,void 0,(function*(){if(!this.connected||!this.publicKey)throw new Error("Wallet not connected");try{const t=e.map((e=>d(e))),{transactions:n}=yield this._sendIframeMessage({method:"signAllTransactionsV2",params:{transactions:t.map((e=>o().encode(e)))}});return n.map(((t,n)=>c(e[n])?i.Transaction.from(o().decode(t)):i.VersionedTransaction.deserialize(o().decode(t))))}catch(e){throw new Error((null===(t=null==e?void 0:e.toString)||void 0===t?void 0:t.call(e))||"Failed to sign transactions")}}))}signAndSendTransaction(e,t){var n;return K(this,void 0,void 0,(function*(){if(!this.connected||!this.publicKey)throw new Error("Wallet not connected");try{const n=d(e),{signature:i}=yield this._sendIframeMessage({method:"signAndSendTransaction",params:{transaction:o().encode(n),options:t}});return i}catch(e){throw new Error((null===(n=null==e?void 0:e.toString)||void 0===n?void 0:n.call(e))||"Failed to sign and send transaction")}}))}signMessage(e,t="utf8"){var n;return K(this,void 0,void 0,(function*(){if(!this.connected||!this.publicKey)throw new Error("Wallet not connected");try{const{signature:n}=yield this._sendIframeMessage({method:"signMessage",params:{data:o().encode(e),display:t}});return Uint8Array.from(o().decode(n))}catch(e){throw new Error((null===(n=null==e?void 0:e.toString)||void 0===n?void 0:n.call(e))||"Failed to sign message")}}))}sign(e,t="utf8"){return K(this,void 0,void 0,(function*(){return yield this.signMessage(e,t)}))}static isSupported(){return K(this,void 0,void 0,(function*(){return!!(yield function(){return l(this,void 0,void 0,(function*(){try{const e=window.ethereum;if(!e)return null;if(e.providers&&Array.isArray(e.providers)){const t=e.providers;for(const e of t)if(yield h(e))return e}if(e.detected&&Array.isArray(e.detected)){const t=e.detected;for(const e of t)if(yield h(e))return e}return(yield h(e))?e:null}catch(e){return console.error(e),null}}))}())}))}standardSignAndSendTransaction(...e){return K(this,void 0,void 0,(function*(){if(!this.connected)throw new Error("not connected");const t=[];if(1===e.length){const{transaction:n,account:r,chain:s,options:a}=e[0],{minContextSlot:c,preflightCommitment:d,skipPreflight:l,maxRetries:h}=a||{};if(r!==this._account)throw new Error("invalid account");if(!v(s))throw new Error("invalid chain");const u=yield this.signAndSendTransaction(i.VersionedTransaction.deserialize(n),{preflightCommitment:d,minContextSlot:c,maxRetries:h,skipPreflight:l});t.push({signature:o().decode(u)})}else if(e.length>1)for(const n of e)t.push(...yield this.standardSignAndSendTransaction(n));return t}))}standardSignTransaction(...e){return K(this,void 0,void 0,(function*(){if(!this.connected)throw new Error("not connected");const t=[];if(1===e.length){const{transaction:n,account:r,chain:s}=e[0];if(r!==this._account)throw new Error("invalid account");if(s&&!v(s))throw new Error("invalid chain");const o=yield this.signTransaction(i.VersionedTransaction.deserialize(n));t.push({signedTransaction:o.serialize()})}else if(e.length>1){let n;for(const t of e){if(t.account!==this._account)throw new Error("invalid account");if(t.chain){if(!v(t.chain))throw new Error("invalid chain");if(n){if(t.chain!==n)throw new Error("conflicting chain")}else n=t.chain}}const r=e.map((({transaction:e})=>i.VersionedTransaction.deserialize(e))),s=yield this.signAllTransactions(r);t.push(...s.map((e=>({signedTransaction:e.serialize()}))))}return t}))}standardSignMessage(...e){return K(this,void 0,void 0,(function*(){if(!this.connected)throw new Error("not connected");const t=[];if(1===e.length){const{message:n,account:i}=e[0];if(i!==this._account)throw new Error("invalid account");const r=yield this.signMessage(n);t.push({signedMessage:n,signature:r})}else if(e.length>1)for(const n of e)t.push(...yield this.standardSignMessage(n));return t}))}}C.IFRAME_URL="https://widget.solflare.com/";const z=C},82582:e=>{e.exports=function(e){if(e.length>=255)throw new TypeError("Alphabet too long");for(var t=new Uint8Array(256),n=0;n<t.length;n++)t[n]=255;for(var i=0;i<e.length;i++){var r=e.charAt(i),s=r.charCodeAt(0);if(255!==t[s])throw new TypeError(r+" is ambiguous");t[s]=i}var o=e.length,a=e.charAt(0),c=Math.log(o)/Math.log(256),d=Math.log(256)/Math.log(o);function l(e){if("string"!=typeof e)throw new TypeError("Expected String");if(0===e.length)return new Uint8Array;for(var n=0,i=0,r=0;e[n]===a;)i++,n++;for(var s=(e.length-n)*c+1>>>0,d=new Uint8Array(s);e[n];){var l=t[e.charCodeAt(n)];if(255===l)return;for(var h=0,u=s-1;(0!==l||h<r)&&-1!==u;u--,h++)l+=o*d[u]>>>0,d[u]=l%256>>>0,l=l/256>>>0;if(0!==l)throw new Error("Non-zero carry");r=h,n++}for(var f=s-r;f!==s&&0===d[f];)f++;for(var m=new Uint8Array(i+(s-f)),g=i;f!==s;)m[g++]=d[f++];return m}return{encode:function(t){if(t instanceof Uint8Array||(ArrayBuffer.isView(t)?t=new Uint8Array(t.buffer,t.byteOffset,t.byteLength):Array.isArray(t)&&(t=Uint8Array.from(t))),!(t instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(0===t.length)return"";for(var n=0,i=0,r=0,s=t.length;r!==s&&0===t[r];)r++,n++;for(var c=(s-r)*d+1>>>0,l=new Uint8Array(c);r!==s;){for(var h=t[r],u=0,f=c-1;(0!==h||u<i)&&-1!==f;f--,u++)h+=256*l[f]>>>0,l[f]=h%o>>>0,h=h/o>>>0;if(0!==h)throw new Error("Non-zero carry");i=u,r++}for(var m=c-i;m!==c&&0===l[m];)m++;for(var g=a.repeat(n);m<c;++m)g+=e.charAt(l[m]);return g},decodeUnsafe:l,decode:function(e){var t=l(e);if(t)return t;throw new Error("Non-base"+o+" character")}}}},5117:(e,t,n)=>{const i=n(82582);e.exports=i("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz")}};
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
export const id=613;export const ids=[613];export const modules={42613:(e,t,i)=>{i.r(t),i.d(t,{W3mModal:()=>c});var o=i(17340),s=i(6479),n=i(94062),a=i(86280);const r=n.AH`
|
|
2
|
+
:host {
|
|
3
|
+
z-index: var(--w3m-z-index);
|
|
4
|
+
display: block;
|
|
5
|
+
backface-visibility: hidden;
|
|
6
|
+
will-change: opacity;
|
|
7
|
+
position: fixed;
|
|
8
|
+
top: 0;
|
|
9
|
+
left: 0;
|
|
10
|
+
right: 0;
|
|
11
|
+
bottom: 0;
|
|
12
|
+
pointer-events: none;
|
|
13
|
+
opacity: 0;
|
|
14
|
+
background-color: var(--wui-cover);
|
|
15
|
+
transition: opacity 0.2s var(--wui-ease-out-power-2);
|
|
16
|
+
will-change: opacity;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
:host(.open) {
|
|
20
|
+
opacity: 1;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
wui-card {
|
|
24
|
+
max-width: var(--w3m-modal-width);
|
|
25
|
+
width: 100%;
|
|
26
|
+
position: relative;
|
|
27
|
+
animation: zoom-in 0.2s var(--wui-ease-out-power-2);
|
|
28
|
+
animation-fill-mode: backwards;
|
|
29
|
+
outline: none;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
wui-card[shake='true'] {
|
|
33
|
+
animation:
|
|
34
|
+
zoom-in 0.2s var(--wui-ease-out-power-2),
|
|
35
|
+
w3m-shake 0.5s var(--wui-ease-out-power-2);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
wui-flex {
|
|
39
|
+
overflow-x: hidden;
|
|
40
|
+
overflow-y: auto;
|
|
41
|
+
display: flex;
|
|
42
|
+
align-items: center;
|
|
43
|
+
justify-content: center;
|
|
44
|
+
width: 100%;
|
|
45
|
+
height: 100%;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
@media (max-height: 700px) and (min-width: 431px) {
|
|
49
|
+
wui-flex {
|
|
50
|
+
align-items: flex-start;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
wui-card {
|
|
54
|
+
margin: var(--wui-spacing-xxl) 0px;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
@media (max-width: 430px) {
|
|
59
|
+
wui-flex {
|
|
60
|
+
align-items: flex-end;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
wui-card {
|
|
64
|
+
max-width: 100%;
|
|
65
|
+
border-bottom-left-radius: 0;
|
|
66
|
+
border-bottom-right-radius: 0;
|
|
67
|
+
border-bottom: none;
|
|
68
|
+
animation: slide-in 0.2s var(--wui-ease-out-power-2);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
wui-card[shake='true'] {
|
|
72
|
+
animation:
|
|
73
|
+
slide-in 0.2s var(--wui-ease-out-power-2),
|
|
74
|
+
w3m-shake 0.5s var(--wui-ease-out-power-2);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
@keyframes zoom-in {
|
|
79
|
+
0% {
|
|
80
|
+
transform: scale(0.95) translateY(0);
|
|
81
|
+
}
|
|
82
|
+
100% {
|
|
83
|
+
transform: scale(1) translateY(0);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
@keyframes slide-in {
|
|
88
|
+
0% {
|
|
89
|
+
transform: scale(1) translateY(50px);
|
|
90
|
+
}
|
|
91
|
+
100% {
|
|
92
|
+
transform: scale(1) translateY(0);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
@keyframes w3m-shake {
|
|
97
|
+
0% {
|
|
98
|
+
transform: scale(1) rotate(0deg);
|
|
99
|
+
}
|
|
100
|
+
20% {
|
|
101
|
+
transform: scale(1) rotate(-1deg);
|
|
102
|
+
}
|
|
103
|
+
40% {
|
|
104
|
+
transform: scale(1) rotate(1.5deg);
|
|
105
|
+
}
|
|
106
|
+
60% {
|
|
107
|
+
transform: scale(1) rotate(-1.5deg);
|
|
108
|
+
}
|
|
109
|
+
80% {
|
|
110
|
+
transform: scale(1) rotate(1deg);
|
|
111
|
+
}
|
|
112
|
+
100% {
|
|
113
|
+
transform: scale(1) rotate(0deg);
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
@keyframes w3m-view-height {
|
|
118
|
+
from {
|
|
119
|
+
height: var(--prev-height);
|
|
120
|
+
}
|
|
121
|
+
to {
|
|
122
|
+
height: var(--new-height);
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
`;var d=function(e,t,i,o){var s,n=arguments.length,a=n<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,i):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,i,o);else for(var r=e.length-1;r>=0;r--)(s=e[r])&&(a=(n<3?s(a):n>3?s(t,i,a):s(t,i))||a);return n>3&&a&&Object.defineProperty(t,i,a),a};const l="scroll-lock";let c=class extends n.WF{constructor(){super(),this.unsubscribe=[],this.abortController=void 0,this.open=o.W3.state.open,this.caipAddress=o.Uj.state.caipAddress,this.isSiweEnabled=o.Hd.state.isSiweEnabled,this.connected=o.Uj.state.isConnected,this.loading=o.W3.state.loading,this.shake=o.W3.state.shake,this.initializeTheming(),o.Np.prefetch(),this.unsubscribe.push(o.W3.subscribeKey("open",(e=>e?this.onOpen():this.onClose())),o.W3.subscribeKey("shake",(e=>this.shake=e)),o.W3.subscribeKey("loading",(e=>{this.loading=e,this.onNewAddress(o.Uj.state.caipAddress)})),o.Uj.subscribeKey("isConnected",(e=>this.connected=e)),o.Uj.subscribeKey("caipAddress",(e=>this.onNewAddress(e))),o.Hd.subscribeKey("isSiweEnabled",(e=>this.isSiweEnabled=e))),o.En.sendEvent({type:"track",event:"MODAL_LOADED"})}disconnectedCallback(){this.unsubscribe.forEach((e=>e())),this.onRemoveKeyboardListener()}render(){return this.open?n.qy`
|
|
126
|
+
<wui-flex @click=${this.onOverlayClick.bind(this)}>
|
|
127
|
+
<wui-card shake="${this.shake}" role="alertdialog" aria-modal="true" tabindex="0">
|
|
128
|
+
<w3m-header></w3m-header>
|
|
129
|
+
<w3m-router></w3m-router>
|
|
130
|
+
<w3m-snackbar></w3m-snackbar>
|
|
131
|
+
</wui-card>
|
|
132
|
+
</wui-flex>
|
|
133
|
+
<w3m-tooltip></w3m-tooltip>
|
|
134
|
+
`:null}async onOverlayClick(e){e.target===e.currentTarget&&await this.handleClose()}async handleClose(){const e="ConnectingSiwe"===o.IN.state.view,t="ApproveTransaction"===o.IN.state.view;if(this.isSiweEnabled){const{SIWEController:s}=await i.e(48).then(i.bind(i,24667));"success"!==s.state.status&&(e||t)?o.W3.shake():o.W3.close()}else o.W3.close()}initializeTheming(){const{themeVariables:e,themeMode:t}=o.Wn.state,i=s.UiHelperUtil.getColorTheme(t);(0,s.initializeTheming)(e,i)}onClose(){this.open=!1,this.classList.remove("open"),this.onScrollUnlock(),o.Pt.hide(),this.onRemoveKeyboardListener()}onOpen(){this.open=!0,this.classList.add("open"),this.onScrollLock(),this.onAddKeyboardListener()}onScrollLock(){const e=document.createElement("style");e.dataset.w3m=l,e.textContent="\n body {\n touch-action: none;\n overflow: hidden;\n overscroll-behavior: contain;\n }\n w3m-modal {\n pointer-events: auto;\n }\n ",document.head.appendChild(e)}onScrollUnlock(){const e=document.head.querySelector(`style[data-w3m="${l}"]`);e&&e.remove()}onAddKeyboardListener(){this.abortController=new AbortController;const e=this.shadowRoot?.querySelector("wui-card");e?.focus(),window.addEventListener("keydown",(t=>{if("Escape"===t.key)this.handleClose();else if("Tab"===t.key){const{tagName:i}=t.target;!i||i.includes("W3M-")||i.includes("WUI-")||e?.focus()}}),this.abortController)}onRemoveKeyboardListener(){this.abortController?.abort(),this.abortController=void 0}async onNewAddress(e){if(!this.connected||this.loading)return;const t=o.wE.getPlainAddress(this.caipAddress),s=o.wE.getPlainAddress(e),n=o.wE.getNetworkId(this.caipAddress),a=o.wE.getNetworkId(e);if(this.caipAddress=e,this.isSiweEnabled){const{SIWEController:e}=await i.e(48).then(i.bind(i,24667)),o=await e.getSession();if(o&&t&&s&&t!==s)return void(e.state._client?.options.signOutOnAccountChange&&(await e.signOut(),this.onSiweNavigation()));if(o&&n&&a&&n!==a)return void(e.state._client?.options.signOutOnNetworkChange&&(await e.signOut(),this.onSiweNavigation()));this.onSiweNavigation()}}onSiweNavigation(){this.open?o.IN.push("ConnectingSiwe"):o.W3.open({view:"ConnectingSiwe"})}};c.styles=r,d([(0,a.wk)()],c.prototype,"open",void 0),d([(0,a.wk)()],c.prototype,"caipAddress",void 0),d([(0,a.wk)()],c.prototype,"isSiweEnabled",void 0),d([(0,a.wk)()],c.prototype,"connected",void 0),d([(0,a.wk)()],c.prototype,"loading",void 0),d([(0,a.wk)()],c.prototype,"shake",void 0),c=d([(0,s.customElement)("w3m-modal")],c)}};
|
package/build/700.index.js
CHANGED
|
File without changes
|
package/build/701.index.js
CHANGED
|
File without changes
|