@dodoex/wallet-web3 0.0.22-1 → 0.0.22-3
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/__node-resolve_empty-0100ccbe.js +1 -0
- package/dist/__tslib-edb9da71.js +1 -0
- package/dist/_commonjs-dynamic-modules-7cfc9805.js +1 -0
- package/dist/blocto-8d7de7b5.js +7 -0
- package/dist/bn-e338479f.js +1 -0
- package/dist/browser-ponyfill-4f8ec4cc.js +1 -0
- package/dist/cjs/__node-resolve_empty-db84e05a.cjs +1 -0
- package/dist/cjs/__tslib-12427cac.cjs +1 -0
- package/dist/cjs/_commonjs-dynamic-modules-f09a98c7.cjs +1 -0
- package/dist/cjs/blocto-5784523c.cjs +7 -0
- package/dist/cjs/bn-595d299a.cjs +1 -0
- package/dist/cjs/browser-ponyfill-99cd2b2a.cjs +1 -0
- package/dist/cjs/ethers-8dd84195.cjs +1 -0
- package/dist/cjs/id-ae785b22.cjs +1 -0
- package/dist/cjs/index-095f26b3.cjs +1 -0
- package/dist/cjs/index-1eddf6b7.cjs +1 -0
- package/dist/cjs/index-1ee2a405.cjs +1 -0
- package/dist/cjs/index-2dac57a4.cjs +1 -0
- package/dist/cjs/index-3bc984a2.cjs +1 -0
- package/dist/cjs/index-47036dc9.cjs +15 -0
- package/dist/cjs/index-4d18447a.cjs +1 -0
- package/dist/cjs/index-4ee3ab7f.cjs +1 -0
- package/dist/cjs/index-70269942.cjs +1 -0
- package/dist/cjs/index-773f2765.cjs +46 -0
- package/dist/cjs/index-99b925f5.cjs +10 -0
- package/dist/cjs/index-cf3bf3b5.cjs +3 -0
- package/dist/cjs/index-df8e5839.cjs +1 -0
- package/dist/cjs/index-eb09e54d.cjs +60 -0
- package/dist/cjs/index.cjs +1 -1
- package/dist/cjs/index.es-6f21f76e.cjs +9 -0
- package/dist/cjs/interface-6285bef3.cjs +1 -0
- package/dist/cjs/portis-ec351600.cjs +24 -0
- package/dist/cjs/provider-6f06969f.cjs +1 -0
- package/dist/cjs/rainbow-cb1bd1d4.cjs +1 -0
- package/dist/cjs/uAuth-21c58fc5.cjs +1 -0
- package/dist/cjs/walletConnect-4e88eea6.cjs +1 -0
- package/dist/cjs/walletLink-4cf61eb3.cjs +1 -0
- package/dist/ethers-d98a529c.js +1 -0
- package/dist/id-bb7887d8.js +1 -0
- package/dist/index-0ee5ef8d.js +60 -0
- package/dist/index-1dc7fa04.js +1 -0
- package/dist/index-32669120.js +15 -0
- package/dist/index-5a901c0e.js +2 -0
- package/dist/index-6be6f872.js +1 -0
- package/dist/index-9201db0c.js +1 -0
- package/dist/index-98f05edd.js +1 -0
- package/dist/index-a0101310.js +1 -0
- package/dist/index-c2c32c9a.js +46 -0
- package/dist/index-d1e775cf.js +10 -0
- package/dist/index-e0d3617a.js +1 -0
- package/dist/index-e17029da.js +1 -0
- package/dist/index-fbd509d6.js +1 -0
- package/dist/index-fe1624e3.js +1 -0
- package/dist/index.es-e051edf2.js +9 -0
- package/dist/index.js +1 -1
- package/dist/interface-2066cc0e.js +1 -0
- package/dist/portis-a96be943.js +24 -0
- package/dist/provider-01f3e885.js +1 -0
- package/dist/rainbow-5bfe748a.js +1 -0
- package/dist/uAuth-4cf1112e.js +1 -0
- package/dist/walletConnect-7c22cd4c.js +1 -0
- package/dist/walletLink-ad1c9d2e.js +1 -0
- package/package.json +1 -1
- package/dist/blocto-4a33d5ca.js +0 -1
- package/dist/cjs/blocto-c3de72cf.cjs +0 -1
- package/dist/cjs/index-00f30b53.cjs +0 -1
- package/dist/cjs/index-27eb8948.cjs +0 -1
- package/dist/cjs/index-34d28fe1.cjs +0 -1
- package/dist/cjs/index-6777aca7.cjs +0 -1
- package/dist/cjs/index-8fb559d0.cjs +0 -1
- package/dist/cjs/index-e29346ca.cjs +0 -1
- package/dist/cjs/portis-698618a3.cjs +0 -1
- package/dist/cjs/provider-9c8505bc.cjs +0 -1
- package/dist/cjs/rainbow-fa30e364.cjs +0 -1
- package/dist/cjs/uAuth-27f2257f.cjs +0 -1
- package/dist/cjs/walletConnect-63cd4764.cjs +0 -1
- package/dist/cjs/walletLink-6bf8d19c.cjs +0 -1
- package/dist/index-09ced70e.js +0 -1
- package/dist/index-1ca259fc.js +0 -1
- package/dist/index-4ee60b82.js +0 -1
- package/dist/index-775efe7e.js +0 -1
- package/dist/index-96419f54.js +0 -1
- package/dist/index-dec2384f.js +0 -1
- package/dist/portis-1fbfa428.js +0 -1
- package/dist/provider-df49c5bf.js +0 -1
- package/dist/rainbow-52844e55.js +0 -1
- package/dist/uAuth-9bf2390c.js +0 -1
- package/dist/walletConnect-eb49e4f6.js +0 -1
- package/dist/walletLink-103ec7de.js +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{_ as e}from"./index-d1e775cf.js";import"events";import"@ethersproject/providers";import"zustand";import"@ethersproject/constants";import"@ethersproject/contracts";import"@ethersproject/address";import"@ethersproject/properties";import"@ethersproject/transactions";import"@ethersproject/bytes";const t="dapp-inpage-integration",i="openblock-content-integration",n=["https://cocoswap.com","https://app.openocean.finance"],o=["https://oec.cocoswap.com"];class s{constructor(){console.log("start initialize openblockinpage provider"),this.callBackList={},this.eventListener={},this.isMetaMask=!0,this.isOpenBlock=!0,this.chainId=null,this.networkVersion=null,this.selectedAddress=null,this.request=this.request.bind(this),this.send=this.send.bind(this),this.sendAsync=this.sendAsync.bind(this),this.on=this.on.bind(this),this.isConnected=this.isConnected.bind(this),this.enable=this.enable.bind(this),this._metamask=this._getExperimentalApi(),this._initInpageListener(),this.getProviderData()}getProviderData(){var t;return e(this,void 0,void 0,(function*(){const e=yield this.request("metamask_getProviderState");this.chainId=null==e?void 0:e.chainId,this.networkVersion=null==e?void 0:e.networkVersion,this.selectedAddress=null===(t=null==e?void 0:e.accounts)||void 0===t?void 0:t[0]}))}request(t){return e(this,void 0,void 0,(function*(){if("eth_requestAccounts"===t.method){const e=yield this._hookRequest("eth_accounts");if(e.length)return new Promise((t=>t(e)))}return this._hookRequest(t)}))}send(...t){return e(this,void 0,void 0,(function*(){if("function"!=typeof t[1])return"string"==typeof t[0]?this.request({method:t[0],params:t[1]}):1===t.length?this.request(t):void 0;this.sendAsync(t[0],t[1])}))}sendAsync(...t){return e(this,void 0,void 0,(function*(){const e={method:t[0].method,params:t[0].params},i=t[0].id;this.request(e).then((e=>{t[1](null,{id:i,jsonrpc:"2.0",result:e})})).catch((e=>{t[1](null,{id:i,jsonrpc:"2.0",error:e})}))}))}isConnected(){return!0}enable(){return e(this,void 0,void 0,(function*(){const e=yield this._hookRequest("eth_accounts");return e.length?new Promise((t=>t(e))):this.request({method:"eth_requestAccounts"})}))}on(e,t){"string"==typeof e&&"function"==typeof t&&(this.eventListener[e]&&this.eventListener[e].length>5||(this.eventListener[e]?(this.eventListener[e].push(t),this.eventListener[e]=Array.from(new Set(this.eventListener[e]))):this.eventListener[e]||(this.eventListener=Object.assign(Object.assign({},this.eventListener),{[e]:[t]})),this._registerEvent(e)))}removeListener(){}_initInpageListener(){window.addEventListener("message",(e=>{var i,n,o;if(e.data.target!==t)return;const s=null===(o=null===(n=null===(i=e.data)||void 0===i?void 0:i.value)||void 0===n?void 0:n.data)||void 0===o?void 0:o.mark;s&&("call_method"===s.type?this._handleNormalMethod(s,e):"register_event"===s.type&&this._handleEventMethod(s,e))}),!1)}_handleNormalMethod(e,t){var i,n,o,s,r;(null===(i=t.data.value.data)||void 0===i?void 0:i.error)?null===(n=this.callBackList[e.id])||void 0===n||n.reject(null===(o=t.data.value.data)||void 0===o?void 0:o.error):null===(s=this.callBackList[e.id])||void 0===s||s.resolve(null===(r=t.data.value.data)||void 0===r?void 0:r.result),delete this.callBackList[e.id]}_handleEventMethod(e,t){var i,s,r,d,a,h,l;const c=null===(d=null===(r=null===(s=null===(i=t.data)||void 0===i?void 0:i.value)||void 0===s?void 0:s.data)||void 0===r?void 0:r.mark)||void 0===d?void 0:d.eventName,u=null===(l=null===(h=null===(a=t.data)||void 0===a?void 0:a.value)||void 0===h?void 0:h.data)||void 0===l?void 0:l.params;if(c){const e=this.eventListener[c];if(!e)return void("https://app.openocean.finance"===window.location.origin&&window.location.reload());e.forEach((e=>{"chainChanged"===c&&(this.chainId=u,this.networkVersion=Number(u)),o.includes(window.location.origin)&&"chainChanged"===c||(n.includes(window.location.origin)?window.location.reload():e(u))}))}}_hookRequest(e){return new Promise(((n,o)=>{const s=(()=>{function e(){return(65536*(1+Math.random())|0).toString(16).substring(1)}return e()+e()+e()+e()+e()+e()+e()+e()})();"string"==typeof e&&(e={method:e}),e=Object.assign(Object.assign({},e),{mark:{id:s,method:e.method,type:"call_method"}}),window.parent.postMessage({from:t,target:i,data:e},"*"),this.callBackList[s]={resolve:n,reject:o}}))}_registerEvent(e){const n={mark:{eventName:e,type:"register_event"},eventName:e};window.parent.postMessage({from:t,target:i,data:n},"*")}_getExperimentalApi(){return new Proxy({isUnlocked:()=>new Promise((e=>e(!0)))},{get:(e,t,...i)=>Reflect.get(e,t,...i)})}}function r(){var e;if(null===(e=window.obethereum)||void 0===e?void 0:e.isOpenBlock)return window.obethereum;let t=new s;t=new Proxy(t,{deleteProperty:()=>!0});try{Object.defineProperty(window,"obethereum",{set(e){console.log("set ethereum",e)},get:()=>t})}catch(e){console.log("initializeProvider error",e),window.obethereum=t}return window.web3=Object.assign({},window.web3),window.web3.currentProvider=t,window.dispatchEvent(new Event("ethereum#initialized")),t}export{r as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{_ as e,l as o,n as t,d as n}from"./index-d1e775cf.js";import{G as r}from"./index.es-e051edf2.js";import"@ethersproject/address";import"events";import"@ethersproject/providers";import"zustand";import"@ethersproject/constants";import"@ethersproject/contracts";import"@ethersproject/properties";import"@ethersproject/transactions";import"@ethersproject/bytes";import"./_commonjs-dynamic-modules-7cfc9805.js";import"./__node-resolve_empty-0100ccbe.js";import"./__tslib-edb9da71.js";import"./browser-ponyfill-4f8ec4cc.js";function c({chainId:c,rpcUrl:i,rpc:s,walletConnectParams:a,darkMode:d},p){return e(this,void 0,void 0,(function*(){let l,m,h="wss://relay.walletconnect.com",j=!0;a&&(h=a.bridge||h,j=void 0!==a.qrcode?a.qrcode:j,a.infuraId,m=a.qrModalOptions||void 0),s?l=s:c&&i&&(l={[c]:i});const u=o(),b=yield r.init({projectId:"59e050d1f27ed617e65bb9637c9498d6",chains:c?[c]:[],showQrModal:!u,rpcMap:l,qrModalOptions:Object.assign({themeMode:d?"dark":"light"},m)});return b.on("display_uri",(e=>{(null==m?void 0:m.openCallback)&&m.openCallback(e)})),b.on("connect",p.connect),b.on("disconnect",(e=>{p.disconnect(e),p.accountsChanged([])})),b.on("accountsChanged",p.accountsChanged),b.on("chainChanged",p.chainChanged),b.on("message",(({type:e,data:o})=>p.message(e,o))),new Promise((o=>e(this,void 0,void 0,(function*(){u?(b.once("display_uri",(e=>{let r=e;t()&&(r=`rainbow://wc?uri=${encodeURIComponent(e)}&connector=rainbowkit`),window.location.href=r,o(n(b))})),b.enable()):(yield b.enable(),o(n(b)))}))))}))}export{c as default};
|