@dodoex/wallet-web3 0.6.4 → 0.6.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/PhArrowCircleDown-4a08ae8e.js +14 -0
- package/dist/PhArrowClockwise-401ea1c0.js +14 -0
- package/dist/PhArrowDown-789ae7d2.js +14 -0
- package/dist/PhArrowLeft-2e6d4940.js +14 -0
- package/dist/PhArrowRight-2928b0dc.js +14 -0
- package/dist/PhArrowSquareOut-17d61d08.js +14 -0
- package/dist/PhArrowUp-1cfcf9df.js +14 -0
- package/dist/PhArrowUpRight-552c41cb.js +14 -0
- package/dist/PhArrowsClockwise-92a70162.js +14 -0
- package/dist/PhArrowsDownUp-ce27c8a7.js +14 -0
- package/dist/PhArrowsLeftRight-ed549dc7.js +14 -0
- package/dist/PhBank-92a1a1df.js +14 -0
- package/dist/PhBrowser-495dc3ce.js +14 -0
- package/dist/PhCaretDown-610f20fc.js +14 -0
- package/dist/PhCaretLeft-2a86ee53.js +14 -0
- package/dist/PhCaretRight-f3057f58.js +14 -0
- package/dist/PhCaretUp-7b74b8cb.js +14 -0
- package/dist/PhCheck-c514f32c.js +14 -0
- package/dist/PhCircleHalf-3bfd24c9.js +14 -0
- package/dist/PhClock-29284ead.js +14 -0
- package/dist/PhCompass-101d3241.js +14 -0
- package/dist/PhCopy-d92dcd27.js +14 -0
- package/dist/PhCreditCard-d8d77fc2.js +14 -0
- package/dist/PhCurrencyDollar-6553df79.js +14 -0
- package/dist/PhDesktop-91653c8e.js +14 -0
- package/dist/PhDeviceMobile-0f3d8fa2.js +14 -0
- package/dist/PhDotsThree-67debca2.js +14 -0
- package/dist/PhEnvelope-f83faab2.js +14 -0
- package/dist/PhFunnelSimple-5058af43.js +14 -0
- package/dist/PhGlobe-c4653621.js +14 -0
- package/dist/PhIdentificationCard-848bf9a1.js +14 -0
- package/dist/PhImage-de71fc6b.js +14 -0
- package/dist/PhInfo-9614a766.js +14 -0
- package/dist/PhLightbulb-7d582ae7.js +14 -0
- package/dist/PhMagnifyingGlass-c926bd63.js +14 -0
- package/dist/PhPaperPlaneRight-76b25832.js +14 -0
- package/dist/PhPlus-767ddc55.js +14 -0
- package/dist/PhPower-95f188dd.js +14 -0
- package/dist/PhPuzzlePiece-f016afe5.js +14 -0
- package/dist/PhQrCode-e9b7ab93.js +14 -0
- package/dist/PhQuestion-ea0e639d.js +14 -0
- package/dist/PhQuestionMark-13d6338e.js +14 -0
- package/dist/PhSealCheck-45bb7b9c.js +14 -0
- package/dist/PhSignOut-6b91c59c.js +14 -0
- package/dist/PhSpinner-eb9b7ac1.js +14 -0
- package/dist/PhTrash-758cc3b3.js +14 -0
- package/dist/PhUser-0834861d.js +14 -0
- package/dist/PhVault-e4d6f9af.js +14 -0
- package/dist/PhWallet-5e257abe.js +14 -0
- package/dist/PhWarning-6af3740e.js +14 -0
- package/dist/PhWarningCircle-a78fd8e8.js +14 -0
- package/dist/PhX-60c46532.js +14 -0
- package/dist/{__tslib-83c7dd77.js → __tslib-6d6a586c.js} +1 -1
- package/dist/{alchemy-provider-5870b6fa-ef26112b.js → alchemy-provider-5870b6fa-a9fe5aa5.js} +1 -1
- package/dist/{alchemy-websocket-provider-213da986-2d698146.js → alchemy-websocket-provider-213da986-16164c2e.js} +1 -1
- package/dist/basic-77fe1b96.js +1320 -0
- package/dist/{blocto-05d7faf5.js → blocto-ab8ba330.js} +1 -1
- package/dist/{ccip-ea7099a8.js → ccip-e246f9cf.js} +1 -1
- package/dist/cjs/PhArrowCircleDown-df23d036.cjs +14 -0
- package/dist/cjs/PhArrowClockwise-440d23dc.cjs +14 -0
- package/dist/cjs/PhArrowDown-252590ed.cjs +14 -0
- package/dist/cjs/PhArrowLeft-d480faa4.cjs +14 -0
- package/dist/cjs/PhArrowRight-969dbdd8.cjs +14 -0
- package/dist/cjs/PhArrowSquareOut-eabfdecb.cjs +14 -0
- package/dist/cjs/PhArrowUp-66bd5f15.cjs +14 -0
- package/dist/cjs/PhArrowUpRight-6df3b31b.cjs +14 -0
- package/dist/cjs/PhArrowsClockwise-3a9d2dc6.cjs +14 -0
- package/dist/cjs/PhArrowsDownUp-47a7788f.cjs +14 -0
- package/dist/cjs/PhArrowsLeftRight-f90368dd.cjs +14 -0
- package/dist/cjs/PhBank-670a2708.cjs +14 -0
- package/dist/cjs/PhBrowser-b9c35fd1.cjs +14 -0
- package/dist/cjs/PhCaretDown-11a46455.cjs +14 -0
- package/dist/cjs/PhCaretLeft-04f11ca7.cjs +14 -0
- package/dist/cjs/PhCaretRight-391111c1.cjs +14 -0
- package/dist/cjs/PhCaretUp-b17dccf6.cjs +14 -0
- package/dist/cjs/PhCheck-08bf36b0.cjs +14 -0
- package/dist/cjs/PhCircleHalf-0a9eac35.cjs +14 -0
- package/dist/cjs/PhClock-cf1cc2cb.cjs +14 -0
- package/dist/cjs/PhCompass-e9671b30.cjs +14 -0
- package/dist/cjs/PhCopy-9132cbc5.cjs +14 -0
- package/dist/cjs/PhCreditCard-853e1556.cjs +14 -0
- package/dist/cjs/PhCurrencyDollar-34eea829.cjs +14 -0
- package/dist/cjs/PhDesktop-c02b883b.cjs +14 -0
- package/dist/cjs/PhDeviceMobile-93c2088c.cjs +14 -0
- package/dist/cjs/PhDotsThree-69beaba7.cjs +14 -0
- package/dist/cjs/PhEnvelope-86ee730e.cjs +14 -0
- package/dist/cjs/PhFunnelSimple-056c2f76.cjs +14 -0
- package/dist/cjs/PhGlobe-64c4ee8e.cjs +14 -0
- package/dist/cjs/PhIdentificationCard-ec7a98e0.cjs +14 -0
- package/dist/cjs/PhImage-07904cbb.cjs +14 -0
- package/dist/cjs/PhInfo-34eeeace.cjs +14 -0
- package/dist/cjs/PhLightbulb-39ebe854.cjs +14 -0
- package/dist/cjs/PhMagnifyingGlass-2fbe4400.cjs +14 -0
- package/dist/cjs/PhPaperPlaneRight-e06c210f.cjs +14 -0
- package/dist/cjs/PhPlus-03a04ed3.cjs +14 -0
- package/dist/cjs/PhPower-4cc2ecb8.cjs +14 -0
- package/dist/cjs/PhPuzzlePiece-035d561e.cjs +14 -0
- package/dist/cjs/PhQrCode-37e23b36.cjs +14 -0
- package/dist/cjs/PhQuestion-bfba435e.cjs +14 -0
- package/dist/cjs/PhQuestionMark-8ef38ecf.cjs +14 -0
- package/dist/cjs/PhSealCheck-5458de15.cjs +14 -0
- package/dist/cjs/PhSignOut-2d177ea1.cjs +14 -0
- package/dist/cjs/PhSpinner-e7c590df.cjs +14 -0
- package/dist/cjs/PhTrash-1920f5dc.cjs +14 -0
- package/dist/cjs/PhUser-84a1a685.cjs +14 -0
- package/dist/cjs/PhVault-1493c03f.cjs +14 -0
- package/dist/cjs/PhWallet-f0502f03.cjs +14 -0
- package/dist/cjs/PhWarning-1bf637ba.cjs +14 -0
- package/dist/cjs/PhWarningCircle-b1747661.cjs +14 -0
- package/dist/cjs/PhX-f864d86c.cjs +14 -0
- package/dist/cjs/{__tslib-12e41834.cjs → __tslib-a9f27ba6.cjs} +1 -1
- package/dist/cjs/{alchemy-provider-5870b6fa-683a7f2e.cjs → alchemy-provider-5870b6fa-bb1c607e.cjs} +1 -1
- package/dist/cjs/{alchemy-websocket-provider-213da986-5c9807c6.cjs → alchemy-websocket-provider-213da986-521569b5.cjs} +1 -1
- package/dist/cjs/basic-b777d2b1.cjs +1320 -0
- package/dist/cjs/{blocto-4db38a28.cjs → blocto-09e0d574.cjs} +1 -1
- package/dist/cjs/{ccip-82e883e4.cjs → ccip-6ebee1cf.cjs} +1 -1
- package/dist/cjs/core-78a709db.cjs +210 -0
- package/dist/cjs/{draggabilly-308ac2a9.cjs → draggabilly-76af6217.cjs} +1 -1
- package/dist/cjs/features-fa5c5622.cjs +1 -0
- package/dist/cjs/id-c0538166.cjs +1 -0
- package/dist/cjs/{index-2c097978.cjs → index-07e81389.cjs} +1 -1
- package/dist/cjs/{index-eae76bd0.cjs → index-093cef5a.cjs} +2 -2
- package/dist/cjs/{index-362be9fb.cjs → index-208df3f3.cjs} +1 -1
- package/dist/cjs/{index-c8fa7932.cjs → index-253e7cce.cjs} +1 -1
- package/dist/cjs/index-2e8e7a50.cjs +4 -0
- package/dist/cjs/index-395b933d.cjs +2 -0
- package/dist/cjs/{index-281d00df.cjs → index-54d7fc75.cjs} +1 -1
- package/dist/cjs/{index-3714da35.cjs → index-5d28acf4.cjs} +2 -2
- package/dist/cjs/{index-85a2526e.cjs → index-5dac528b.cjs} +7 -7
- package/dist/cjs/index-702e8f89.cjs +15 -0
- package/dist/cjs/{index-ceda42fb.cjs → index-823e17e6.cjs} +1 -1
- package/dist/cjs/{index-9325806f.cjs → index-916994aa.cjs} +1 -1
- package/dist/cjs/{index-00b0ab99.cjs → index-a2b665f4.cjs} +1 -1
- package/dist/cjs/{index-c6b53b3f.cjs → index-b099293c.cjs} +1 -1
- package/dist/cjs/index-d72ddbc1.cjs +17 -0
- package/dist/cjs/index-ef4ef0cc.cjs +1449 -0
- package/dist/cjs/index.cjs +1 -1
- package/dist/cjs/{interface-10b0ba33.cjs → interface-4947cfa6.cjs} +1 -1
- package/dist/cjs/{lib-typedarrays-012f607a.cjs → lib-typedarrays-a9baf142.cjs} +1 -1
- package/dist/cjs/native-55bb141d.cjs +1 -0
- package/dist/cjs/{portis-2144bb98.cjs → portis-08d9d731.cjs} +1 -1
- package/dist/cjs/property-29e6f732.cjs +29 -0
- package/dist/cjs/providers/connector/safeGnosis/query.d.ts +2 -1
- package/dist/cjs/providers/connector/types.d.ts +1 -1
- package/dist/cjs/providers/wallets/index.d.ts +1 -0
- package/dist/cjs/rainbow-6e84bcfa.cjs +1 -0
- package/dist/cjs/sha224-b46bc3e6.cjs +1 -0
- package/dist/cjs/sha256-ccd47519.cjs +1 -0
- package/dist/cjs/{typed-data-e878587d.cjs → typed-data-5176b792.cjs} +1 -1
- package/dist/cjs/uAuth-b29d2670.cjs +1 -0
- package/dist/cjs/w3m-modal-70bcf6d8.cjs +2380 -0
- package/dist/cjs/walletConnect-20d477a9.cjs +1 -0
- package/dist/cjs/{walletLink-8e49b6d5.cjs → walletLink-08b8da20.cjs} +2 -2
- package/dist/core-4d7ad6f2.js +210 -0
- package/dist/{draggabilly-c6f65920.js → draggabilly-daf3b444.js} +1 -1
- package/dist/features-d8d1c9ce.js +1 -0
- package/dist/id-d4d22b29.js +1 -0
- package/dist/{index-227927b5.js → index-09298bd0.js} +7 -7
- package/dist/{index-f360d801.js → index-244a8189.js} +1 -1
- package/dist/{index-f4727f94.js → index-2ad0fb2a.js} +1 -1
- package/dist/index-35d87b79.js +17 -0
- package/dist/{index-eb473b84.js → index-587ff998.js} +1 -1
- package/dist/{index-a6b10e09.js → index-750a7dfe.js} +1 -1
- package/dist/{index-abb4eaf1.js → index-8bd12de1.js} +1 -1
- package/dist/{index-1e0435b6.js → index-938686fb.js} +1 -1
- package/dist/{index-1db47472.js → index-9d7fee1e.js} +2 -2
- package/dist/{index-af823ebd.js → index-aa744ca0.js} +1 -1
- package/dist/{index-cfa6ef57.js → index-b7d25e8a.js} +2 -2
- package/dist/index-bb1a0019.js +15 -0
- package/dist/index-c5ca8a4e.js +4 -0
- package/dist/{index-1cf97dd7.js → index-cddbc8e8.js} +1 -1
- package/dist/index-f095c09e.js +2 -0
- package/dist/index-ffdf981b.js +1449 -0
- package/dist/index.js +1 -1
- package/dist/{interface-ec064b7d.js → interface-0c535796.js} +1 -1
- package/dist/{lib-typedarrays-ecebfb2c.js → lib-typedarrays-979d2723.js} +1 -1
- package/dist/native-029c50f7.js +1 -0
- package/dist/{portis-e3d3d420.js → portis-9602ac9f.js} +1 -1
- package/dist/property-8eb37909.js +35 -0
- package/dist/providers/connector/safeGnosis/query.d.ts +2 -1
- package/dist/providers/connector/types.d.ts +1 -1
- package/dist/providers/wallets/index.d.ts +1 -0
- package/dist/rainbow-ccab7a95.js +1 -0
- package/dist/sha224-fe98e1bf.js +1 -0
- package/dist/sha256-5a24dfd5.js +1 -0
- package/dist/{typed-data-0f706378.js → typed-data-3a3d44dc.js} +1 -1
- package/dist/uAuth-27f5728d.js +1 -0
- package/dist/w3m-modal-49add722.js +2380 -0
- package/dist/walletConnect-a541881e.js +1 -0
- package/dist/{walletLink-68441960.js → walletLink-67264328.js} +2 -2
- package/package.json +3 -3
- package/dist/_commonjs-dynamic-modules-7cfc9805.js +0 -1
- package/dist/cjs/_commonjs-dynamic-modules-f09a98c7.cjs +0 -1
- package/dist/cjs/id-ea22b6ce.cjs +0 -1
- package/dist/cjs/index-35edc6a0.cjs +0 -60
- package/dist/cjs/index-8a25465c.cjs +0 -6
- package/dist/cjs/index-9f2a69d5.cjs +0 -1
- package/dist/cjs/index-fdda1836.cjs +0 -17
- package/dist/cjs/index.es-80622213.cjs +0 -9
- package/dist/cjs/rainbow-18d05876.cjs +0 -1
- package/dist/cjs/sha224-1c092a15.cjs +0 -1
- package/dist/cjs/sha256-9e1680c1.cjs +0 -1
- package/dist/cjs/uAuth-b89f7081.cjs +0 -1
- package/dist/cjs/walletConnect-b79e1e97.cjs +0 -1
- package/dist/id-397f0303.js +0 -1
- package/dist/index-02e42cd2.js +0 -17
- package/dist/index-65d96278.js +0 -60
- package/dist/index-89717995.js +0 -6
- package/dist/index-f08d6a6b.js +0 -1
- package/dist/index.es-7adbb6c0.js +0 -9
- package/dist/rainbow-73b82cd7.js +0 -1
- package/dist/sha224-51e5e6a9.js +0 -1
- package/dist/sha256-549e482b.js +0 -1
- package/dist/uAuth-ce19d386.js +0 -1
- package/dist/walletConnect-b0b635de.js +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{c as t}from"./index-
|
|
1
|
+
import{c as t}from"./index-09298bd0.js";function i(t,i){return i.forEach((function(i){i&&"string"!=typeof i&&!Array.isArray(i)&&Object.keys(i).forEach((function(e){if("default"!==e&&!(e in t)){var n=Object.getOwnPropertyDescriptor(i,e);Object.defineProperty(t,e,n.get?n:{enumerable:!0,get:function(){return i[e]}})}}))})),Object.freeze(t)}var e,n={exports:{}},o={exports:{}};function s(){return e||(e=1,t=o,function(i,e){t.exports?t.exports=e():i.getSize=e()}(window,(function(){function t(t){let i=parseFloat(t);return-1==t.indexOf("%")&&!isNaN(i)&&i}let i=["paddingLeft","paddingRight","paddingTop","paddingBottom","marginLeft","marginRight","marginTop","marginBottom","borderLeftWidth","borderRightWidth","borderTopWidth","borderBottomWidth"];return function(e){if("string"==typeof e&&(e=document.querySelector(e)),!e||"object"!=typeof e||!e.nodeType)return;let n=getComputedStyle(e);if("none"==n.display)return function(){let t={width:0,height:0,innerWidth:0,innerHeight:0,outerWidth:0,outerHeight:0};return i.forEach((i=>{t[i]=0})),t}();let o={};o.width=e.offsetWidth,o.height=e.offsetHeight;let s=o.isBorderBox="border-box"==n.boxSizing;i.forEach((t=>{let i=n[t],e=parseFloat(i);o[t]=isNaN(e)?0:e}));let r=o.paddingLeft+o.paddingRight,h=o.paddingTop+o.paddingBottom,a=o.marginLeft+o.marginRight,d=o.marginTop+o.marginBottom,l=o.borderLeftWidth+o.borderRightWidth,c=o.borderTopWidth+o.borderBottomWidth,u=t(n.width);!1!==u&&(o.width=u+(s?0:r+l));let p=t(n.height);return!1!==p&&(o.height=p+(s?0:h+c)),o.innerWidth=o.width-(r+l),o.innerHeight=o.height-(h+c),o.outerWidth=o.width+a,o.outerHeight=o.height+d,o}}))),o.exports;var t}var r,h,a,d={exports:{}},l={exports:{}};function c(){return r||(r=1,i=l,e="undefined"!=typeof window?window:t,n=function(){function t(){}let i=t.prototype;return i.on=function(t,i){if(!t||!i)return this;let e=this._events=this._events||{},n=e[t]=e[t]||[];return n.includes(i)||n.push(i),this},i.once=function(t,i){if(!t||!i)return this;this.on(t,i);let e=this._onceEvents=this._onceEvents||{};return(e[t]=e[t]||{})[i]=!0,this},i.off=function(t,i){let e=this._events&&this._events[t];if(!e||!e.length)return this;let n=e.indexOf(i);return-1!=n&&e.splice(n,1),this},i.emitEvent=function(t,i){let e=this._events&&this._events[t];if(!e||!e.length)return this;e=e.slice(0),i=i||[];let n=this._onceEvents&&this._onceEvents[t];for(let o of e)n&&n[o]&&(this.off(t,o),delete n[o]),o.apply(this,i);return this},i.allOff=function(){return delete this._events,delete this._onceEvents,this},t},i.exports?i.exports=n():e.EvEmitter=n()),l.exports;var i,e,n}
|
|
2
2
|
/*!
|
|
3
3
|
* Unidragger v3.0.1
|
|
4
4
|
* Draggable base class
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{j as e,a2 as t,a3 as s,a4 as r,c as o,a5 as n,K as i,A as a}from"./core-4d7ad6f2.js";import"events";import"./index-c5ca8a4e.js";import"./__tslib-6d6a586c.js";import"./index-09298bd0.js";import"@ethersproject/providers";import"zustand";import"@ethersproject/bytes";import"@ethersproject/properties";import"@ethersproject/address";import"@ethersproject/abstract-signer";import"buffer";import"@ethersproject/abstract-provider";import"@ethersproject/contracts";import"@ethersproject/constants";import"@ethersproject/transactions";class c{constructor(e){this.getNonce=e.getNonce}async createMessage(e){const t={accountAddress:e.accountAddress,chainId:e.chainId,version:"1",domain:"undefined"==typeof document?"Unknown Domain":document.location.host,uri:"undefined"==typeof document?"Unknown URI":document.location.href,resources:this.resources,nonce:await this.getNonce(e),issuedAt:this.stringifyDate(new Date),statement:void 0,expirationTime:void 0,notBefore:void 0},s={toString:()=>this.stringify(t)};return Object.assign(t,s)}stringify(e){const t=this.getNetworkName(e.chainId);return[`${e.domain} wants you to sign in with your ${t} account:`,e.accountAddress,e.statement?`\n${e.statement}\n`:"",`URI: ${e.uri}`,`Version: ${e.version}`,`Chain ID: ${e.chainId}`,`Nonce: ${e.nonce}`,e.issuedAt&&`Issued At: ${e.issuedAt}`,e.expirationTime&&`Expiration Time: ${e.expirationTime}`,e.notBefore&&`Not Before: ${e.notBefore}`,e.requestId&&`Request ID: ${e.requestId}`,e.resources?.length&&e.resources.reduce(((e,t)=>`${e}\n- ${t}`),"Resources:")].filter((e=>"string"==typeof e)).join("\n").trim()}getNetworkName(s){const r=e.getAllRequestedCaipNetworks();return t.getNetworkNameByCaipNetworkId(r,s)}stringifyDate(e){return e.toISOString()}}class h{constructor(e={}){this.otpUuid=null,this.listeners={sessionChanged:[]},this.localAuthStorageKey=e.localAuthStorageKey||s.SIWX_AUTH_TOKEN,this.localNonceStorageKey=e.localNonceStorageKey||s.SIWX_NONCE_TOKEN,this.required=e.required??!0,this.messenger=new c({getNonce:this.getNonce.bind(this)})}async createMessage(e){return this.messenger.createMessage(e)}async addSession(e){const t=await this.request({method:"POST",key:"authenticate",body:{data:e.data,message:e.message,signature:e.signature,clientId:this.getClientId(),walletInfo:this.getWalletInfo()},headers:["nonce","otp"]});this.setStorageToken(t.token,this.localAuthStorageKey),this.emit("sessionChanged",e),this.setAppKitAccountUser(function(e){const t=e.split(".");if(3!==t.length)throw new Error("Invalid token");const s=t[1];if("string"!=typeof s)throw new Error("Invalid token");const r=s.replace(/-/gu,"+").replace(/_/gu,"/"),o=r.padEnd(r.length+(4-r.length%4)%4,"=");return JSON.parse(atob(o))}(t.token)),this.otpUuid=null}async getSessions(e,t){try{if(!this.getStorageToken(this.localAuthStorageKey))return[];const s=await this.request({method:"GET",key:"me",query:{},headers:["auth"]});if(!s)return[];const r=s.address.toLowerCase()===t.toLowerCase(),o=s.caip2Network===e;if(!r||!o)return[];const n={data:{accountAddress:s.address,chainId:s.caip2Network},message:"",signature:""};return this.emit("sessionChanged",n),this.setAppKitAccountUser(s),[n]}catch{return[]}}async revokeSession(e,t){return Promise.resolve(this.clearStorageTokens())}async setSessions(e){if(0===e.length)this.clearStorageTokens();else{const t=e.find((e=>e.data.chainId===r()?.caipNetworkId))||e[0];await this.addSession(t)}}getRequired(){return this.required}async getSessionAccount(){if(!this.getStorageToken(this.localAuthStorageKey))throw new Error("Not authenticated");return this.request({method:"GET",key:"me",body:void 0,query:{includeAppKitAccount:!0},headers:["auth"]})}async setSessionAccountMetadata(e=null){if(!this.getStorageToken(this.localAuthStorageKey))throw new Error("Not authenticated");return this.request({method:"PUT",key:"account-metadata",body:{metadata:e},headers:["auth"]})}on(e,t){return this.listeners[e].push(t),()=>{this.listeners[e]=this.listeners[e].filter((e=>e!==t))}}removeAllListeners(){Object.keys(this.listeners).forEach((e=>{this.listeners[e]=[]}))}async requestEmailOtp({email:e,account:t}){const s=await this.request({method:"POST",key:"otp",body:{email:e,account:t}});return this.otpUuid=s.uuid,this.messenger.resources=[`email:${e}`],s}confirmEmailOtp({code:e}){return this.request({method:"PUT",key:"otp",body:{code:e},headers:["otp"]})}async request({method:e,key:t,query:s,body:r,headers:n}){const{projectId:i,st:a,sv:c}=this.getSDKProperties(),h=new URL(`${o.W3M_API_URL}/auth/v1/${String(t)}`);h.searchParams.set("projectId",i),h.searchParams.set("st",a),h.searchParams.set("sv",c),s&&Object.entries(s).forEach((([e,t])=>h.searchParams.set(e,String(t))));const u=await fetch(h,{method:e,body:r?JSON.stringify(r):void 0,headers:Array.isArray(n)?n.reduce(((e,t)=>{switch(t){case"nonce":e["x-nonce-jwt"]=`Bearer ${this.getStorageToken(this.localNonceStorageKey)}`;break;case"auth":e.Authorization=`Bearer ${this.getStorageToken(this.localAuthStorageKey)}`;break;case"otp":this.otpUuid&&(e["x-otp"]=this.otpUuid)}return e}),{}):void 0});if(!u.ok)throw new Error(await u.text());return u.headers.get("content-type")?.includes("application/json")?u.json():null}getStorageToken(e){return n.getItem(e)}setStorageToken(e,t){n.setItem(t,e)}clearStorageTokens(){this.otpUuid=null,n.removeItem(this.localAuthStorageKey),n.removeItem(this.localNonceStorageKey),this.emit("sessionChanged",void 0)}async getNonce(){const{nonce:e,token:t}=await this.request({method:"GET",key:"nonce"});return this.setStorageToken(t,this.localNonceStorageKey),e}getClientId(){return i.state.clientId}getWalletInfo(){const t=e.getAccountData()?.connectedWalletInfo;if(!t)return;if("social"in t&&"identifier"in t){return{type:"social",social:t.social,identifier:t.identifier}}const{name:s,icon:r}=t;let o="unknown";switch(t.type){case"EXTERNAL":case"INJECTED":case"ANNOUNCED":o="extension";break;case"WALLET_CONNECT":o="walletconnect";break;default:o="unknown"}return{type:o,name:s,icon:r}}getSDKProperties(){return a._getSdkProperties()}emit(e,t){this.listeners[e].forEach((e=>e(t)))}setAppKitAccountUser(t){const{email:s}=t;s&&Object.values(o.CHAIN).forEach((t=>{e.setAccountProp("user",{email:s},t)}))}}export{h as ReownAuthentication,c as ReownAuthenticationMessenger};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{k as r,t}from"./index-09298bd0.js";function i(i){return r(t(i))}export{i};
|