@dodoex/wallet-web3 0.0.22-1 → 0.0.22-10
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-bd987f04.js +1 -0
- package/dist/__tslib-98a1dd9e.js +1 -0
- package/dist/_commonjs-dynamic-modules-7cfc9805.js +1 -0
- package/dist/blocto-2d3c8b27.js +7 -0
- package/dist/bn-355bdc9a.js +1 -0
- package/dist/browser-ponyfill-2c1a6933.js +1 -0
- package/dist/cjs/__node-resolve_empty-7cfea9ce.cjs +1 -0
- package/dist/cjs/__tslib-2a444824.cjs +1 -0
- package/dist/cjs/_commonjs-dynamic-modules-f09a98c7.cjs +1 -0
- package/dist/cjs/blocto-0dd69cd4.cjs +7 -0
- package/dist/cjs/bn-74240ab6.cjs +1 -0
- package/dist/cjs/browser-ponyfill-80cdb9db.cjs +1 -0
- package/dist/cjs/ethers-f94fd013.cjs +1 -0
- package/dist/cjs/hash-282034e6.cjs +1 -0
- package/dist/cjs/id-5449ee01.cjs +1 -0
- package/dist/cjs/index-19dda89e.cjs +9 -0
- package/dist/cjs/index-21718290.cjs +1 -0
- package/dist/cjs/index-477d4f02.cjs +15 -0
- package/dist/cjs/index-48672518.cjs +1 -0
- package/dist/cjs/index-70269942.cjs +1 -0
- package/dist/cjs/index-9ac6f336.cjs +6 -0
- package/dist/cjs/index-ab075799.cjs +1 -0
- package/dist/cjs/index-b979d8c2.cjs +1 -0
- package/dist/cjs/index-c14950ff.cjs +1 -0
- package/dist/cjs/index-c223d891.cjs +1 -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-b062ab81.cjs +9 -0
- package/dist/cjs/inherits_browser-f88a000a.cjs +1 -0
- package/dist/cjs/interface-6b444f2d.cjs +1 -0
- package/dist/cjs/portis-111be233.cjs +24 -0
- package/dist/cjs/provider-5bfa9b1a.cjs +1 -0
- package/dist/cjs/rainbow-877d817c.cjs +1 -0
- package/dist/cjs/typed-data-3897cf3d.cjs +1 -0
- package/dist/cjs/uAuth-9d5d1a09.cjs +1 -0
- package/dist/cjs/walletConnect-f84ceaee.cjs +1 -0
- package/dist/cjs/walletLink-cc4e8d50.cjs +1 -0
- package/dist/ethers-14301f88.js +1 -0
- package/dist/hash-a9ebd52a.js +1 -0
- package/dist/id-c4c89dc1.js +1 -0
- package/dist/index-07969599.js +1 -0
- package/dist/index-0ee5ef8d.js +60 -0
- package/dist/index-2104fec5.js +1 -0
- package/dist/index-5a901c0e.js +2 -0
- package/dist/index-66542573.js +1 -0
- package/dist/index-6aac09e5.js +1 -0
- package/dist/index-6be6f872.js +1 -0
- package/dist/index-805e7072.js +1 -0
- package/dist/index-8416bb35.js +15 -0
- package/dist/index-a9572f52.js +6 -0
- package/dist/index-c87c4e31.js +9 -0
- package/dist/index-e0d3617a.js +1 -0
- package/dist/index-e1bd2c59.js +1 -0
- package/dist/index.es-9412781b.js +9 -0
- package/dist/index.js +1 -1
- package/dist/inherits_browser-06ba108b.js +1 -0
- package/dist/interface-d2437305.js +1 -0
- package/dist/portis-26c2f185.js +24 -0
- package/dist/provider-bdb500b5.js +1 -0
- package/dist/rainbow-5fd230d8.js +1 -0
- package/dist/typed-data-1ad553ac.js +1 -0
- package/dist/uAuth-3cb8dfac.js +1 -0
- package/dist/walletConnect-38b59552.js +1 -0
- package/dist/walletLink-812aa298.js +1 -0
- package/package.json +6 -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
|
+
"use strict";var e=require("./index-19dda89e.cjs");require("events"),require("@ethersproject/providers"),require("zustand"),require("@ethersproject/constants"),require("@ethersproject/contracts"),require("@ethersproject/address"),require("@ethersproject/properties"),require("@ethersproject/transactions"),require("@ethersproject/bytes");const t="dapp-inpage-integration",i="openblock-content-integration",n=["https://cocoswap.com","https://app.openocean.finance"],s=["https://oec.cocoswap.com"];class o{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.__awaiter(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.__awaiter(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.__awaiter(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.__awaiter(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.__awaiter(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,s;if(e.data.target!==t)return;const o=null===(s=null===(n=null===(i=e.data)||void 0===i?void 0:i.value)||void 0===n?void 0:n.data)||void 0===s?void 0:s.mark;o&&("call_method"===o.type?this._handleNormalMethod(o,e):"register_event"===o.type&&this._handleEventMethod(o,e))}),!1)}_handleNormalMethod(e,t){var i,n,s,o,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===(s=t.data.value.data)||void 0===s?void 0:s.error):null===(o=this.callBackList[e.id])||void 0===o||o.resolve(null===(r=t.data.value.data)||void 0===r?void 0:r.result),delete this.callBackList[e.id]}_handleEventMethod(e,t){var i,o,r,a,d,h,l;const c=null===(a=null===(r=null===(o=null===(i=t.data)||void 0===i?void 0:i.value)||void 0===o?void 0:o.data)||void 0===r?void 0:r.mark)||void 0===a?void 0:a.eventName,u=null===(l=null===(h=null===(d=t.data)||void 0===d?void 0:d.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)),s.includes(window.location.origin)&&"chainChanged"===c||(n.includes(window.location.origin)?window.location.reload():e(u))}))}}_hookRequest(e){return new Promise(((n,s)=>{const o=(()=>{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:o,method:e.method,type:"call_method"}}),window.parent.postMessage({from:t,target:i,data:e},"*"),this.callBackList[o]={resolve:n,reject:s}}))}_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)})}}exports.default=function(){var e;if(null===(e=window.obethereum)||void 0===e?void 0:e.isOpenBlock)return window.obethereum;let t=new o;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};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var e=require("./index-19dda89e.cjs"),r=require("./index.es-b062ab81.cjs");require("@ethersproject/address"),require("events"),require("@ethersproject/providers"),require("zustand"),require("@ethersproject/constants"),require("@ethersproject/contracts"),require("@ethersproject/properties"),require("@ethersproject/transactions"),require("@ethersproject/bytes"),require("./_commonjs-dynamic-modules-f09a98c7.cjs"),require("./__node-resolve_empty-7cfea9ce.cjs"),require("./__tslib-2a444824.cjs"),require("./browser-ponyfill-80cdb9db.cjs"),exports.default=function({chainId:o,rpcUrl:n,rpc:t,walletConnectParams:c,darkMode:i},s){return e.__awaiter(this,void 0,void 0,(function*(){let a,d,l="wss://relay.walletconnect.com",u=!0;c&&(l=c.bridge||l,u=void 0!==c.qrcode?c.qrcode:u,c.infuraId,d=c.qrModalOptions||void 0),t?a=t:o&&n&&(a={[o]:n});const p=e.getIsMobile(),h=yield r.G.init({projectId:"59e050d1f27ed617e65bb9637c9498d6",chains:o?[o]:[],showQrModal:!p,rpcMap:a,qrModalOptions:Object.assign({themeMode:i?"dark":"light"},d)});return h.on("display_uri",(e=>{(null==d?void 0:d.openCallback)&&d.openCallback(e)})),h.on("connect",s.connect),h.on("disconnect",(e=>{s.disconnect(e),s.accountsChanged([])})),h.on("accountsChanged",s.accountsChanged),h.on("chainChanged",s.chainChanged),h.on("message",(({type:e,data:r})=>s.message(e,r))),new Promise((r=>e.__awaiter(this,void 0,void 0,(function*(){p?(h.once("display_uri",(o=>{let n=o;e.getIsIOS()&&(n=`rainbow://wc?uri=${encodeURIComponent(o)}&connector=rainbowkit`),window.location.href=n,r(e.convertWeb3Provider(h))})),h.enable()):(yield h.enable(),r(e.convertWeb3Provider(h)))}))))}))};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var t=require("@ethersproject/address"),r=require("@ethersproject/bytes"),e=require("./index-19dda89e.cjs"),n=require("@ethersproject/properties"),i=require("./id-5449ee01.cjs");const o="hash/5.7.0";var a=function(t,r,e,n){return new(e||(e=Promise))((function(i,o){function a(t){try{c(n.next(t))}catch(t){o(t)}}function s(t){try{c(n.throw(t))}catch(t){o(t)}}function c(t){var r;t.done?i(t.value):(r=t.value,r instanceof e?r:new e((function(t){t(r)}))).then(a,s)}c((n=n.apply(t,r||[])).next())}))};const s=new i.Logger(o),c=new Uint8Array(32);c.fill(0);const f=i.BigNumber.from(-1),u=i.BigNumber.from(0),h=i.BigNumber.from(1),y=i.BigNumber.from("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");const m=r.hexZeroPad(h.toHexString(),32),d=r.hexZeroPad(u.toHexString(),32),g={name:"string",version:"string",chainId:"uint256",verifyingContract:"address",salt:"bytes32"},p=["name","version","chainId","verifyingContract","salt"];function l(t){return function(r){return"string"!=typeof r&&s.throwArgumentError(`invalid domain value for ${JSON.stringify(t)}`,`domain.${t}`,r),r}}const v={name:l("name"),version:l("version"),chainId:function(t){try{return i.BigNumber.from(t).toString()}catch(t){}return s.throwArgumentError('invalid domain value for "chainId"',"domain.chainId",t)},verifyingContract:function(r){try{return t.getAddress(r).toLowerCase()}catch(t){}return s.throwArgumentError('invalid domain value "verifyingContract"',"domain.verifyingContract",r)},salt:function(t){try{const e=r.arrayify(t);if(32!==e.length)throw new Error("bad length");return r.hexlify(e)}catch(t){}return s.throwArgumentError('invalid domain value "salt"',"domain.salt",t)}};function w(n){{const t=n.match(/^(u?)int(\d*)$/);if(t){const e=""===t[1],o=parseInt(t[2]||"256");(o%8!=0||o>256||t[2]&&t[2]!==String(o))&&s.throwArgumentError("invalid numeric width","type",n);const a=y.mask(e?o-1:o),c=e?a.add(h).mul(f):u;return function(t){const e=i.BigNumber.from(t);return(e.lt(c)||e.gt(a))&&s.throwArgumentError(`value out-of-bounds for ${n}`,"value",t),r.hexZeroPad(e.toTwos(256).toHexString(),32)}}}{const t=n.match(/^bytes(\d+)$/);if(t){const e=parseInt(t[1]);return(0===e||e>32||t[1]!==String(e))&&s.throwArgumentError("invalid bytes width","type",n),function(t){return r.arrayify(t).length!==e&&s.throwArgumentError(`invalid length for ${n}`,"value",t),function(t){const e=r.arrayify(t),n=e.length%32;return n?r.hexConcat([e,c.slice(n)]):r.hexlify(e)}(t)}}}switch(n){case"address":return function(e){return r.hexZeroPad(t.getAddress(e),32)};case"bool":return function(t){return t?m:d};case"bytes":return function(t){return e.keccak256(t)};case"string":return function(t){return i.id(t)}}return null}function E(t,r){return`${t}(${r.map((({name:t,type:r})=>r+" "+t)).join(",")})`}class x{constructor(t){n.defineReadOnly(this,"types",Object.freeze(n.deepCopy(t))),n.defineReadOnly(this,"_encoderCache",{}),n.defineReadOnly(this,"_types",{});const r={},e={},i={};Object.keys(t).forEach((t=>{r[t]={},e[t]=[],i[t]={}}));for(const n in t){const i={};t[n].forEach((o=>{i[o.name]&&s.throwArgumentError(`duplicate variable name ${JSON.stringify(o.name)} in ${JSON.stringify(n)}`,"types",t),i[o.name]=!0;const a=o.type.match(/^([^\x5b]*)(\x5b|$)/)[1];a===n&&s.throwArgumentError(`circular type reference to ${JSON.stringify(a)}`,"types",t);w(a)||(e[a]||s.throwArgumentError(`unknown type ${JSON.stringify(a)}`,"types",t),e[a].push(n),r[n][a]=!0)}))}const o=Object.keys(e).filter((t=>0===e[t].length));0===o.length?s.throwArgumentError("missing primary type","types",t):o.length>1&&s.throwArgumentError(`ambiguous primary types or unused types: ${o.map((t=>JSON.stringify(t))).join(", ")}`,"types",t),n.defineReadOnly(this,"primaryType",o[0]),function n(o,a){a[o]&&s.throwArgumentError(`circular type reference to ${JSON.stringify(o)}`,"types",t),a[o]=!0,Object.keys(r[o]).forEach((t=>{e[t]&&(n(t,a),Object.keys(a).forEach((r=>{i[r][t]=!0})))})),delete a[o]}(this.primaryType,{});for(const r in i){const e=Object.keys(i[r]);e.sort(),this._types[r]=E(r,t[r])+e.map((r=>E(r,t[r]))).join("")}}getEncoder(t){let r=this._encoderCache[t];return r||(r=this._encoderCache[t]=this._getEncoder(t)),r}_getEncoder(t){{const r=w(t);if(r)return r}const n=t.match(/^(.*)(\x5b(\d*)\x5d)$/);if(n){const t=n[1],i=this.getEncoder(t),o=parseInt(n[3]);return n=>{o>=0&&n.length!==o&&s.throwArgumentError("array length mismatch; expected length ${ arrayLength }","value",n);let a=n.map(i);return this._types[t]&&(a=a.map(e.keccak256)),e.keccak256(r.hexConcat(a))}}const o=this.types[t];if(o){const n=i.id(this._types[t]);return t=>{const i=o.map((({name:r,type:n})=>{const i=this.getEncoder(n)(t[r]);return this._types[n]?e.keccak256(i):i}));return i.unshift(n),r.hexConcat(i)}}return s.throwArgumentError(`unknown type: ${t}`,"type",t)}encodeType(t){const r=this._types[t];return r||s.throwArgumentError(`unknown type: ${JSON.stringify(t)}`,"name",t),r}encodeData(t,r){return this.getEncoder(t)(r)}hashStruct(t,r){return e.keccak256(this.encodeData(t,r))}encode(t){return this.encodeData(this.primaryType,t)}hash(t){return this.hashStruct(this.primaryType,t)}_visit(t,r,e){if(w(t))return e(t,r);const n=t.match(/^(.*)(\x5b(\d*)\x5d)$/);if(n){const t=n[1],i=parseInt(n[3]);return i>=0&&r.length!==i&&s.throwArgumentError("array length mismatch; expected length ${ arrayLength }","value",r),r.map((r=>this._visit(t,r,e)))}const i=this.types[t];return i?i.reduce(((t,{name:n,type:i})=>(t[n]=this._visit(i,r[n],e),t)),{}):s.throwArgumentError(`unknown type: ${t}`,"type",t)}visit(t,r){return this._visit(this.primaryType,t,r)}static from(t){return new x(t)}static getPrimaryType(t){return x.from(t).primaryType}static hashStruct(t,r,e){return x.from(r).hashStruct(t,e)}static hashDomain(t){const r=[];for(const e in t){const n=g[e];n||s.throwArgumentError(`invalid typed-data domain key: ${JSON.stringify(e)}`,"domain",t),r.push({name:e,type:n})}return r.sort(((t,r)=>p.indexOf(t.name)-p.indexOf(r.name))),x.hashStruct("EIP712Domain",{EIP712Domain:r},t)}static encode(t,e,n){return r.hexConcat(["0x1901",x.hashDomain(t),x.from(e).hash(n)])}static hash(t,r,n){return e.keccak256(x.encode(t,r,n))}static resolveNames(t,e,i,o){return a(this,void 0,void 0,(function*(){t=n.shallowCopy(t);const a={};t.verifyingContract&&!r.isHexString(t.verifyingContract,20)&&(a[t.verifyingContract]="0x");const s=x.from(e);s.visit(i,((t,e)=>("address"!==t||r.isHexString(e,20)||(a[e]="0x"),e)));for(const t in a)a[t]=yield o(t);return t.verifyingContract&&a[t.verifyingContract]&&(t.verifyingContract=a[t.verifyingContract]),i=s.visit(i,((t,r)=>"address"===t&&a[r]?a[r]:r)),{domain:t,value:i}}))}static getPayload(t,e,o){x.hashDomain(t);const a={},c=[];p.forEach((r=>{const e=t[r];null!=e&&(a[r]=v[r](e),c.push({name:r,type:g[r]}))}));const f=x.from(e),u=n.shallowCopy(e);return u.EIP712Domain?s.throwArgumentError("types must not contain EIP712Domain type","types.EIP712Domain",e):u.EIP712Domain=c,f.encode(o),{types:u,domain:a,primaryType:f.primaryType,message:f.visit(o,((t,e)=>{if(t.match(/^bytes(\d*)/))return r.hexlify(r.arrayify(e));if(t.match(/^u?int/))return i.BigNumber.from(e).toString();switch(t){case"address":return e.toLowerCase();case"bool":return!!e;case"string":return"string"!=typeof e&&s.throwArgumentError("invalid string","value",e),e}return s.throwArgumentError("unsupported type","type",t)}))}}}exports.TypedDataEncoder=x,exports.version=o;
|