@dodoex/wallet-web3 0.0.22-2 → 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.
Files changed (105) hide show
  1. package/dist/__node-resolve_empty-0100ccbe.js +1 -0
  2. package/dist/__tslib-edb9da71.js +1 -0
  3. package/dist/blocto-8d7de7b5.js +7 -0
  4. package/dist/bn-e338479f.js +1 -0
  5. package/dist/browser-ponyfill-4f8ec4cc.js +1 -0
  6. package/dist/cjs/__node-resolve_empty-db84e05a.cjs +1 -0
  7. package/dist/cjs/__tslib-12427cac.cjs +1 -0
  8. package/dist/cjs/blocto-5784523c.cjs +7 -0
  9. package/dist/cjs/bn-595d299a.cjs +1 -0
  10. package/dist/cjs/browser-ponyfill-99cd2b2a.cjs +1 -0
  11. package/dist/cjs/ethers-8dd84195.cjs +1 -0
  12. package/dist/cjs/id-ae785b22.cjs +1 -0
  13. package/dist/cjs/{index-5d7b94fd.cjs → index-095f26b3.cjs} +1 -1
  14. package/dist/cjs/index-1eddf6b7.cjs +1 -0
  15. package/dist/cjs/index-1ee2a405.cjs +1 -0
  16. package/dist/cjs/index-2dac57a4.cjs +1 -0
  17. package/dist/cjs/{index-f2c04d55.cjs → index-3bc984a2.cjs} +1 -1
  18. package/dist/cjs/index-47036dc9.cjs +15 -0
  19. package/dist/cjs/index-4d18447a.cjs +1 -0
  20. package/dist/cjs/{index-4585c950.cjs → index-4ee3ab7f.cjs} +1 -1
  21. package/dist/cjs/index-773f2765.cjs +46 -0
  22. package/dist/cjs/index-99b925f5.cjs +10 -0
  23. package/dist/cjs/index-cf3bf3b5.cjs +3 -0
  24. package/dist/cjs/{index-3d1a3da9.cjs → index-df8e5839.cjs} +1 -1
  25. package/dist/cjs/index-eb09e54d.cjs +60 -0
  26. package/dist/cjs/index.cjs +1 -1
  27. package/dist/cjs/index.es-6f21f76e.cjs +9 -0
  28. package/dist/cjs/{interface-1b54eefa.cjs → interface-6285bef3.cjs} +1 -1
  29. package/dist/cjs/portis-ec351600.cjs +24 -0
  30. package/dist/cjs/{provider-403219c9.cjs → provider-6f06969f.cjs} +1 -1
  31. package/dist/cjs/rainbow-cb1bd1d4.cjs +1 -0
  32. package/dist/cjs/uAuth-21c58fc5.cjs +1 -0
  33. package/dist/cjs/walletConnect-4e88eea6.cjs +1 -0
  34. package/dist/cjs/walletLink-4cf61eb3.cjs +1 -0
  35. package/dist/ethers-d98a529c.js +1 -0
  36. package/dist/id-bb7887d8.js +1 -0
  37. package/dist/index-0ee5ef8d.js +60 -0
  38. package/dist/index-1dc7fa04.js +1 -0
  39. package/dist/index-32669120.js +15 -0
  40. package/dist/index-5a901c0e.js +2 -0
  41. package/dist/{index-235259d8.js → index-9201db0c.js} +1 -1
  42. package/dist/index-98f05edd.js +1 -0
  43. package/dist/{index-de37f6bb.js → index-a0101310.js} +1 -1
  44. package/dist/index-c2c32c9a.js +46 -0
  45. package/dist/index-d1e775cf.js +10 -0
  46. package/dist/{index-5f9e8321.js → index-e0d3617a.js} +1 -1
  47. package/dist/index-e17029da.js +1 -0
  48. package/dist/index-fbd509d6.js +1 -0
  49. package/dist/{index-650785ec.js → index-fe1624e3.js} +1 -1
  50. package/dist/index.es-e051edf2.js +9 -0
  51. package/dist/index.js +1 -1
  52. package/dist/{interface-f97a878a.js → interface-2066cc0e.js} +1 -1
  53. package/dist/portis-a96be943.js +24 -0
  54. package/dist/{provider-453e2483.js → provider-01f3e885.js} +1 -1
  55. package/dist/rainbow-5bfe748a.js +1 -0
  56. package/dist/uAuth-4cf1112e.js +1 -0
  57. package/dist/walletConnect-7c22cd4c.js +1 -0
  58. package/dist/walletLink-ad1c9d2e.js +1 -0
  59. package/package.json +1 -1
  60. package/dist/__tslib-dd22ed7d.js +0 -1
  61. package/dist/blocto-69a506f8.js +0 -1
  62. package/dist/bn-3e892825.js +0 -1
  63. package/dist/cjs/__tslib-8344f379.cjs +0 -1
  64. package/dist/cjs/blocto-bdab3cea.cjs +0 -1
  65. package/dist/cjs/bn-ce9dbccd.cjs +0 -1
  66. package/dist/cjs/ethers-767c2337.cjs +0 -1
  67. package/dist/cjs/id-6c4d97dd.cjs +0 -1
  68. package/dist/cjs/index-2428f0a6.cjs +0 -1
  69. package/dist/cjs/index-4abb9db3.cjs +0 -1
  70. package/dist/cjs/index-659dc842.cjs +0 -61
  71. package/dist/cjs/index-67e59d1a.cjs +0 -1
  72. package/dist/cjs/index-795ad993.cjs +0 -46
  73. package/dist/cjs/index-a5fa1e6e.cjs +0 -15
  74. package/dist/cjs/index-aa04e7a3.cjs +0 -1
  75. package/dist/cjs/index-cfe3e391.cjs +0 -10
  76. package/dist/cjs/index-d226aab9.cjs +0 -8
  77. package/dist/cjs/index-e875b498.cjs +0 -1
  78. package/dist/cjs/index.es-a3704620.cjs +0 -9
  79. package/dist/cjs/node-ponyfill-a7a0b431.cjs +0 -1
  80. package/dist/cjs/portis-ec0ce54d.cjs +0 -1
  81. package/dist/cjs/rainbow-caa66e39.cjs +0 -1
  82. package/dist/cjs/uAuth-a2d2617a.cjs +0 -1
  83. package/dist/cjs/walletConnect-c57b3b5d.cjs +0 -1
  84. package/dist/cjs/walletLink-f0f9e2a7.cjs +0 -3
  85. package/dist/ethers-51e19435.js +0 -1
  86. package/dist/id-830e09aa.js +0 -1
  87. package/dist/index-3158e93a.js +0 -46
  88. package/dist/index-46c2059e.js +0 -1
  89. package/dist/index-5091218e.js +0 -1
  90. package/dist/index-6bf494b0.js +0 -1
  91. package/dist/index-80483be2.js +0 -8
  92. package/dist/index-82b4fd64.js +0 -60
  93. package/dist/index-88837567.js +0 -1
  94. package/dist/index-c699a924.js +0 -1
  95. package/dist/index-cc453bb1.js +0 -10
  96. package/dist/index-f3052552.js +0 -15
  97. package/dist/index.es-877101c5.js +0 -9
  98. package/dist/node-ponyfill-55b945e1.js +0 -1
  99. package/dist/portis-7d46b7ed.js +0 -1
  100. package/dist/rainbow-61a52379.js +0 -1
  101. package/dist/uAuth-40d8acab.js +0 -1
  102. package/dist/walletConnect-d6a9aa67.js +0 -1
  103. package/dist/walletLink-106461e6.js +0 -3
  104. /package/dist/cjs/{index-47f3e61d.cjs → index-70269942.cjs} +0 -0
  105. /package/dist/{index-0103e089.js → index-6be6f872.js} +0 -0
@@ -1 +1 @@
1
- import{_ as e}from"./index-cc453bb1.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};
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};