@dodoex/wallet-web3 0.0.19 → 0.0.20
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/{blocto-8a7e5655.js → blocto-11f7e515.js} +1 -1
- package/dist/cjs/{blocto-fde3da03.cjs → blocto-a9bc4aad.cjs} +1 -1
- package/dist/cjs/{index-903b0a91.cjs → index-039a99e9.cjs} +1 -1
- package/dist/cjs/{index-24947ffe.cjs → index-0d4bdd9e.cjs} +1 -1
- package/dist/cjs/{index-8774bb4a.cjs → index-31a8fa64.cjs} +1 -1
- package/dist/cjs/{index-54a05b63.cjs → index-827d44e6.cjs} +1 -1
- package/dist/cjs/{index-55050700.cjs → index-df525de2.cjs} +1 -1
- package/dist/cjs/index.cjs +1 -1
- package/dist/cjs/{portis-fafa5b4d.cjs → portis-642432fb.cjs} +1 -1
- package/dist/cjs/{provider-43b729c6.cjs → provider-3e411ba6.cjs} +1 -1
- package/dist/cjs/{rainbow-346e1c1f.cjs → rainbow-72ef13b7.cjs} +1 -1
- package/dist/cjs/{uAuth-81476caf.cjs → uAuth-747546e3.cjs} +1 -1
- package/dist/cjs/{walletConnect-00bcd8db.cjs → walletConnect-70523459.cjs} +1 -1
- package/dist/cjs/{walletLink-cb5edb6b.cjs → walletLink-27d08706.cjs} +1 -1
- package/dist/{index-0b626329.js → index-2597cffd.js} +1 -1
- package/dist/{index-4eaa8a80.js → index-b0a27059.js} +1 -1
- package/dist/{index-123178a7.js → index-eb78ab39.js} +1 -1
- package/dist/{index-d28094bc.js → index-ee851abe.js} +1 -1
- package/dist/{index-21cbee02.js → index-f4a1cb70.js} +1 -1
- package/dist/index.js +1 -1
- package/dist/{portis-5189ad52.js → portis-5d50fdd7.js} +1 -1
- package/dist/{provider-43d8e330.js → provider-76cbf4ef.js} +1 -1
- package/dist/{rainbow-bf32ad3a.js → rainbow-96cf12f7.js} +1 -1
- package/dist/{uAuth-ff3c38a7.js → uAuth-8873994c.js} +1 -1
- package/dist/{walletConnect-705f67c7.js → walletConnect-cfc4adf2.js} +1 -1
- package/dist/{walletLink-c31ab3ba.js → walletLink-c3ccf5e5.js} +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{_ as t,S as e,k as r,l as n,u as o}from"./index-
|
|
1
|
+
import{_ as t,S as e,k as r,l as n,u as o}from"./index-2597cffd.js";import{JsonRpcProvider as i}from"@ethersproject/providers";import{getAddress as s}from"@ethersproject/address";import{Signer as a}from"@ethersproject/abstract-signer";import{UniPassPopupSDK as d}from"@unipasswallet/popup-sdk";import{deepCopy as c}from"@ethersproject/properties";import{fetchJson as u}from"@ethersproject/web";import"@cyberlab/cyber-app-sdk";import"zustand";import"@ethersproject/constants";import"@ethersproject/contracts";import"@ethersproject/transactions";import"@ethersproject/keccak256";class l extends a{constructor(t,e,r,n){super(),this._address=r,this._index=null!=n?n:0,this.provider=t,this.upWallet=e}_legacySignMessage(t){throw new Error("Method not implemented.")}sendUncheckedTransaction(t){throw new Error("Method not implemented.")}unlock(t){throw new Error("Method not implemented.")}getAddress(){return t(this,void 0,void 0,(function*(){return Promise.resolve(s(this._address))}))}signMessage(e){return t(this,void 0,void 0,(function*(){if(!this.upWallet)throw new Error(`address unknown '${e}'`);return yield this.upWallet.signMessage(e,{isEIP191Prefix:!0,onAuthChain:!0})}))}_signTypedData(e,r,n){return t(this,void 0,void 0,(function*(){throw new Error("Method not implemented.")}))}signTransaction(e){return t(this,void 0,void 0,(function*(){if(!this.upWallet)throw new Error(`address unknown '${e.from}'`);return this.upWallet.sendTransaction({from:e.from,to:e.to,value:e.value,data:e.data})}))}sendTransaction(e){return t(this,void 0,void 0,(function*(){if(!this.upWallet)throw new Error(`address unknown '${e.from}'`);return{hash:yield this.upWallet.sendTransaction({from:e.from,to:e.to,value:e.value,data:e.data}),from:e.from}}))}connect(t){return new l(null!=t?t:this.provider,this.upWallet,this._address,this._index)}connectUnchecked(){return new l(this.provider,this.upWallet,this._address,this._index)}}function h(t){if(t.error){const e=new Error(t.error.message);throw e.code=t.error.code,e.data=t.error.data,e}return t.result}function p(o){var a,p,v;return t(this,void 0,void 0,(function*(){const m=null!==(a=o.chainId)&&void 0!==a?a:1;let f=null!==(p=o.rpcUrl)&&void 0!==p?p:null===(v=o.rpc)||void 0===v?void 0:v[m];const g=new class extends i{constructor(t,i){super(t,i),this.updateUpWalletConfig=t=>{var n;const i=null===(n=o.rpc)||void 0===n?void 0:n[t];if(!e.includes(t)||!i)throw new Error(`chainId ${t} not supported`);return this.upWallet.updateConfig({chainType:r(t),nodeRPC:i,appSettings:{chain:r(t)}}),this.chainId=t,this.rpcUrl=i,this.emit("chainChanged",`0x${t.toString(16)}`),{result:!0}},this.rpcUrl=t,this.chainId=m,this.upWallet=new d({env:n(m),chainType:r(m),appSettings:{appIcon:o.appLogoUrl,appName:o.appName,chain:r(m)},rpcUrl:f,storageType:"sessionStorage"})}getSigner(){var t;const e=this.upWallet.getAccount();return new l(g,this.upWallet,null!==(t=null==e?void 0:e.address)&&void 0!==t?t:"",0)}connect(){return t(this,void 0,void 0,(function*(){const t=this.upWallet.getAccount();return t||(yield this.upWallet.login({email:false}))}))}disconnect(){return t(this,void 0,void 0,(function*(){yield this.upWallet.logout()}))}listAccounts(){return t(this,void 0,void 0,(function*(){const t=this.upWallet.getAccount();return(null==t?void 0:t.address)?[null==t?void 0:t.address]:[]}))}getAddress(){const t=this.upWallet.getAccount();return Promise.resolve((null==t?void 0:t.address)?s(null==t?void 0:t.address):null)}send(t,e){const r={method:t,params:e,id:this._nextId++,jsonrpc:"2.0"};this.emit("debug",{action:"request",request:c(r),provider:this});const n=["eth_chainId","eth_blockNumber"].indexOf(t)>=0;if(n&&this._cache[t])return this._cache[t];const o=u({url:this.rpcUrl},JSON.stringify(r),h).then((t=>(this.emit("debug",{action:"response",request:r,response:t,provider:this}),t)),(t=>{throw this.emit("debug",{action:"response",error:t,request:r,provider:this}),t}));return n&&(this._cache[t]=o,setTimeout((()=>{this._cache[t]=null}),0)),o}}(f);return g}))}function v(e,r){return t(this,void 0,void 0,(function*(){const t=yield p(e);return t.on("connect",r.connect),t.on("disconnect",(t=>{r.disconnect(t),r.accountsChanged([])})),t.on("accountsChanged",r.accountsChanged),t.on("chainChanged",r.chainChanged),t.on("message",(({type:t,data:e})=>r.message(t,e))),yield t.connect(),t}))}function m(){var t;null===(t=o.getState().provider)||void 0===t||t.disconnect()}function f(t){var e,r;return null===(r=null===(e=o.getState().provider)||void 0===e?void 0:e.upWallet)||void 0===r?void 0:r.signTypedData(t)}function g(t){var r;const n=t.addChainParameters.chainId,i="string"==typeof n&&(null==n?void 0:n.startsWith("0x"))?parseInt(n,16):Number(n);if(!e.includes(i))throw new Error(`chainId ${i} not supported`);return null===(r=o.getState().provider)||void 0===r?void 0:r.updateUpWalletConfig(i)}export{p as createProvider,v as default,m as disconnectWallet,f as signTypedData,g as switchChain};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{_ as e,H as t,c as r}from"./index-
|
|
1
|
+
import{_ as e,H as t,c as r}from"./index-2597cffd.js";export{H as HD_PATH_LIST}from"./index-2597cffd.js";import s from"@ledgerhq/hw-app-eth";import i from"@ledgerhq/hw-transport-webhid";import{JsonRpcProvider as n}from"@ethersproject/providers";import{getAddress as o}from"@ethersproject/address";import{resolveProperties as d}from"@ethersproject/properties";import{hexlify as a,joinSignature as c}from"@ethersproject/bytes";import{serialize as h}from"@ethersproject/transactions";import{_TypedDataEncoder as l}from"@ethersproject/hash";import{Signer as p}from"@ethersproject/abstract-signer";import{toUtf8Bytes as u}from"@ethersproject/strings";import{TypedDataUtils as m,SignTypedDataVersion as v}from"@metamask/eth-sig-util";import"@cyberlab/cyber-app-sdk";import"zustand";import"@ethersproject/constants";import"@ethersproject/contracts";import"@ethersproject/keccak256";const f=()=>e(void 0,void 0,void 0,(function*(){return yield i.create()})),y=(t,r,s,i,n,o=[])=>e(void 0,void 0,void 0,(function*(){const e=r.replace(/x/g,String(s+i)),d=yield t.getAddress(e);let a=[...o,{path:e,account:d.address}];return s<n&&(a=yield y(t,r,s+1,i,n,a)),a})),g=(t,r=1,i=5)=>e(void 0,void 0,void 0,(function*(){const e=yield f(),n=new s(e);let o;try{if(-1===t.indexOf("x")){const e=yield n.getAddress(t);return[{path:t,account:e.address}]}const e=r*i-i;o=yield y(n,t,0,e,i-1)}finally{e.close()}return o}));class w extends p{constructor(e,r,s,i,n){super(),this._address=r,this._index=null!=i?i:0,this.path=null!=s?s:t[0].path,this.provider=e,this._fetchGasPrice=n}_legacySignMessage(e){throw new Error("Method not implemented.")}sendUncheckedTransaction(e){throw new Error("Method not implemented.")}unlock(e){throw new Error("Method not implemented.")}getAddress(){return e(this,void 0,void 0,(function*(){return Promise.resolve(o(this._address))}))}signMessage(t){return e(this,void 0,void 0,(function*(){if(!this.path)throw new Error(`address unknown '${this._address}'`);const e=yield f();try{"string"==typeof t&&(t=u(t));const r=new s(e),i=a(t).substring(2),n=yield r.signPersonalMessage(this.path,i);return n.r="0x"+n.r,n.s="0x"+n.s,c(n)}finally{e.close()}}))}_signTypedData(t,r,i){return e(this,void 0,void 0,(function*(){const e=yield f();try{if(!this.path)throw new Error(`address unknown '${this._address}'`);const n=new s(e),o=yield l.resolveNames(t,r,i,(e=>{var t;return null===(t=this.provider)||void 0===t?void 0:t.resolveName(e)})),d=l.getPayload(o.domain,r,o.value),a=m.hashStruct("EIP712Domain",d.domain,r,v.V4).toString("hex"),c=m.hashStruct(d.primaryType,d.message,r,v.V4).toString("hex"),h=yield n.signEIP712HashedMessage(this.path,a,c);let p=parseInt(h.v,10).toString(16);p.length<2&&(p=`0${p}`);return`0x${h.r}${h.s}${p}`}finally{e.close()}}))}signTransaction(t){var i;return e(this,void 0,void 0,(function*(){if(!this.path)throw new Error(`address unknown '${this._address}'`);const e=yield f();try{const n=yield d(t),o=yield r(null!==(i=n.chainId)&&void 0!==i?i:1,n,this._fetchGasPrice);o.nonce=o.nonce?Number(o.nonce):void 0;const a=h(o).substring(2),c=new s(e),l=yield c.signTransaction(this.path,a);return h(o,{v:parseInt(`0x${l.v}`,2),r:"0x"+l.r,s:"0x"+l.s})}finally{e.close()}}))}connect(e){return new w(null!=e?e:this.provider,this._address,this.path,this._index,this._fetchGasPrice)}connectUnchecked(){return new w(this.provider,this._address,this.path,this._index,this._fetchGasPrice)}}function x({rpcUrl:r,fetchGasPrice:s,ledgerParams:i}){var d;return e(this,void 0,void 0,(function*(){if(!r)throw new Error("Ledger USB provider requires rpcUrl");const a=null!==(d=null==i?void 0:i.path)&&void 0!==d?d:t[0].path;let c=null==i?void 0:i.account;const h=yield(yield g(a)).map((e=>e.account));c||(c=h[0]);const l=h.findIndex((e=>e===c));const p=new class extends n{getSigner(){return new w(p,c,a,l,s)}listAccounts(){return e(this,void 0,void 0,(function*(){return yield(yield g(a)).map((e=>e.account))}))}getAddress(){return Promise.resolve(o(c))}}(r);return p}))}function _(t){return e(this,void 0,void 0,(function*(){return yield x(t)}))}export{x as createProvider,_ as default,g as getAccountList,f as getTransport};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{_ as e,d as r,e as t,f as o,h as n,s,u as i}from"./index-
|
|
1
|
+
import{_ as e,d as r,e as t,f as o,h as n,s,u as i}from"./index-2597cffd.js";export{j as getIsCyber}from"./index-2597cffd.js";import{JsonRpcProvider as d}from"@ethersproject/providers";import{getAddress as a}from"@ethersproject/address";import{ErrorType as c}from"@cyberlab/cyber-app-sdk";import{hexlify as h}from"@ethersproject/bytes";import{toUtf8Bytes as p}from"@ethersproject/strings";import{_TypedDataEncoder as u}from"@ethersproject/hash";import{Signer as l}from"@ethersproject/abstract-signer";import{deepCopy as m}from"@ethersproject/properties";import{fetchJson as v}from"@ethersproject/web";import"zustand";import"@ethersproject/constants";import"@ethersproject/contracts";import"@ethersproject/transactions";import"@ethersproject/keccak256";class f extends l{constructor(e,r,t,o){super(),this._address=r,this._index=null!=t?t:0,this.provider=e,this.app=o}_legacySignMessage(e){throw new Error("Method not implemented.")}sendUncheckedTransaction(e){throw new Error("Method not implemented.")}unlock(e){throw new Error("Method not implemented.")}getAddress(){return e(this,void 0,void 0,(function*(){return Promise.resolve(a(this._address))}))}signMessage(t){return e(this,void 0,void 0,(function*(){const e=r(),o="string"==typeof t?p(t):t,n=yield this.getAddress();return yield e.send("personal_sign",[h(o),n.toLowerCase()])}))}_signTypedData(o,n,s){var i,d;return e(this,void 0,void 0,(function*(){const a=r(),c=yield u.resolveNames(o,n,s,(r=>e(this,void 0,void 0,(function*(){return yield a.resolveName(r)})))),h=null!==(d=null===(i=t())||void 0===i?void 0:i.ownerAddress)&&void 0!==d?d:"";return yield a.send("eth_signTypedData_v4",[h.toLowerCase(),JSON.stringify(u.getPayload(c.domain,n,c.value))])}))}signTransaction(r){return e(this,void 0,void 0,(function*(){throw new Error("Method not implemented.")}))}sendTransaction(r){return e(this,void 0,void 0,(function*(){const e=yield this.getChainId(),t=o(this.app,e);return{hash:yield t.sendTransaction({to:r.to,value:r.value,data:r.data}).catch((e=>{if(e.name===c.SendTransactionError)throw console.error(e.shortMessage),e}))}}))}connect(e){return new f(null!=e?e:this.provider,this._address,this._index,this.app)}connectUnchecked(){return new f(this.provider,this._address,this._index,this.app)}}function g(e){if(e.error){const r=new Error(e.error.message);throw r.code=e.error.code,r.data=e.error.data,r}return e.result}function w(r,t){return e(this,void 0,void 0,(function*(){const o=yield function({appName:r,appLogoUrl:t,rpcUrl:o,rpc:i,chainId:c,cyberParams:h}){return e(this,void 0,void 0,(function*(){if(!r||!t)throw new Error("appName and appLogoUrl is required.");if(!(null==h?void 0:h.appId))throw new Error("cyberParams.appId and appLogoUrl is required.");const{app:p,cyberAccount:u}=yield n({appName:r,appLogoUrl:t,appId:null==h?void 0:h.appId});if(!u)throw new Error("cyberAccount is not valid.");const l=u.address,w=new class extends d{constructor(e,r){super(e,r),this.updateUpWalletConfig=e=>{const r=null==i?void 0:i[e];if(!s.includes(e)||!r)throw new Error(`chainId ${e} not supported`);return this.chainId=e,r&&(this.rpcUrl=r),this.emit("chainChanged",`0x${e.toString(16)}`),{result:!0}},this.rpcUrl=e,this.chainId=c}getSigner(){return new f(w,l,0,p)}listAccounts(){return e(this,void 0,void 0,(function*(){return[l]}))}getNetwork(){return this.chainId?Promise.resolve({chainId:this.chainId,name:"unknown"}):super.getNetwork()}send(e,r){const t={method:e,params:r,id:this._nextId++,jsonrpc:"2.0"};this.emit("debug",{action:"request",request:m(t),provider:this});const o=["eth_chainId","eth_blockNumber"].indexOf(e)>=0;if(o&&this._cache[e])return this._cache[e];const n=v({url:this.rpcUrl},JSON.stringify(t),g).then((e=>(this.emit("debug",{action:"response",request:t,response:e,provider:this}),e)),(e=>{throw this.emit("debug",{action:"response",error:e,request:t,provider:this}),e}));return o&&(this._cache[e]=n,setTimeout((()=>{this._cache[e]=null}),0)),n}getAddress(){return Promise.resolve(a(l))}}(o,c);return w}))}(r);return o.on("connect",t.connect),o.on("disconnect",t.disconnect),o.on("accountsChanged",t.accountsChanged),o.on("chainChanged",t.chainChanged),o.on("message",t.message),o}))}function y(e){var r;const t=e.addChainParameters.chainId,o="string"==typeof t&&(null==t?void 0:t.startsWith("0x"))?parseInt(t,16):Number(t);if(!s.includes(o))throw new Error(`chainId ${o} not supported`);return null===(r=i.getState().provider)||void 0===r?void 0:r.updateUpWalletConfig(o)}export{w as default,y as switchChain};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{_ as t,a as e,u as r}from"./index-
|
|
1
|
+
import{_ as t,a as e,u as r}from"./index-2597cffd.js";import o from"@safe-global/safe-apps-sdk";import{SafeAppProvider as n}from"@safe-global/safe-apps-provider";import s from"@safe-global/api-kit";import"@cyberlab/cyber-app-sdk";import"@ethersproject/providers";import"zustand";import"@ethersproject/constants";import"@ethersproject/contracts";import"@ethersproject/address";import"@ethersproject/properties";import"@ethersproject/transactions";import"@ethersproject/keccak256";let i,a;function c(){return t(this,void 0,void 0,(function*(){return a||(a=new o),void 0===i&&(i=yield Promise.race([a.safe.getInfo(),new Promise((t=>setTimeout(t,200)))])),i}))}function f(){return t(this,void 0,void 0,(function*(){return!!(yield c())}))}function u(r){return t(this,void 0,void 0,(function*(){const t=yield c();if(!t)throw Error("Could not load Safe information");const o=new n(t,a);return o.on("connect",r.connect),o.on("disconnect",r.disconnect),o.on("accountsChanged",r.accountsChanged),o.on("chainChanged",r.chainChanged),o.on("message",r.message),e(o)}))}const l={1:"https://safe-transaction-mainnet.safe.global/",5:"https://safe-transaction-goerli.safe.global/",42161:"https://safe-transaction-arbitrum.safe.global/",43114:"https://safe-transaction-avalanche.safe.global/",1313161554:"https://safe-transaction-aurora.safe.global/",56:"https://safe-transaction-bsc.safe.global/",10:"https://safe-transaction-optimism.safe.global/",137:"https://safe-transaction-polygon.safe.global/"};let d;function p(e){return t(this,void 0,void 0,(function*(){if((null==d?void 0:d.chainId)===e)return d.safeService;if(!r.getState().provider)throw new Error("provider is undefined");const o=function(){return{getEip3770Address:e=>t(this,void 0,void 0,(function*(){const{address:t,prefix:r}=function(t){const e=t.split(":"),r=e.length>1?e[1]:e[0];return{prefix:e.length>1?e[0]:"",address:r}}(e);return{address:t,prefix:r}}))}}(),n=l[e];if(!n)return;const i=new s({txServiceUrl:n,ethAdapter:o});return d={safeService:i,chainId:e},d.safeService}))}function h(e,r){return t(this,void 0,void 0,(function*(){if(!r)return!1;const t=yield p(e);if(!t)return!1;try{return!!(yield t.getSafeInfo(r))}catch(t){return console.error(t),!1}}))}function g(e,r,o){return t(this,void 0,void 0,(function*(){const t=yield p(e);if(!t)return console.error(`chainId: ${e} is not supported safe`),o;if(o!==r)return o;const n=yield t.getMultisigTransactions(o),[s]=n.results;return s.safeTxHash}))}function m(e,r,o){return t(this,void 0,void 0,(function*(){const t=yield p(e);if(!t)throw new Error(`chainId: ${e} is not supported safe`);try{const{results:e}=yield t.getMultisigTransactions(o),n=e.find((t=>t.safeTxHash.toLocaleLowerCase()===r.toLocaleLowerCase()));if(!n)return null;if(e.some((t=>!(t.nonce!==n.nonce||t.safeTxHash.toLocaleLowerCase()===r.toLocaleLowerCase()||!t.isExecuted||!t.isSuccessful))))return"rejected";if(null===n.isExecuted||null===n.isSuccessful)return null;return{status:n.isExecuted&&n.isSuccessful||!1,transactionHash:n.transactionHash,blockNumber:n.blockNumber||null}}catch(t){throw console.error(t),new Error(`safeTxHash: ${r} is not valid.`)}}))}function v(t,e,r){const o={1:"eth",5:"gor",137:"matic",56:"bnb",42161:"arb1",10:"oeth",43114:"avax",1313161554:"aurora"}[e];if(!o)throw new Error(`Not Supported network: ${e}`);return`https://app.safe.global/transactions/tx?id=multisig_${r}_${t}&safe=${o}%3A${r}`}export{u as default,h as getAccountIsSafe,c as getConnectedSafe,f as getIsSafe,v as getSafeHashDetailUrl,g as getSafeTxHash,m as getSafeTxStatus};
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export{t as ChainId,H as HD_PATH_LIST,O as OpenBlockIframeWallet,W as WalletType,V as WatchResult,o as allWalletList,a1 as approve,c as convertTransactionType,a as convertWeb3Provider,C as default,J as getBloctoConnector,E as getBloctoPackage,$ as getContract,P as getCyberConnector,G as getCyberPackage,X as getEstimateGas,Y as getGasPrice,y as getGnosisPackage,a8 as getIsAndroid,b as getIsIOS,g as getIsMobile,U as getIsOpenBlockIframe,r as getIsolatedEnvironmentWallet,x as getLedgerUSBPackage,T as getOpenBlockIframeConnector,K as getPortisConnector,A as getPortisPackage,a0 as getProviderByChain,F as getRainbowConnectPackage,N as getRainbowConnector,z as getUAuthPackage,Q as getUniPassConnector,I as getUniPassPackage,M as getWalletConnectConnector,D as getWalletConnectPackage,p as getWalletDisabledState,L as getWalletLinkConnector,B as getWalletLinkPackage,q as getWalletList,ab as getWindow,i as injectedConnect,m as injectedList,v as injectedListObject,ac as isAddress,aa as isLargeIOS,a9 as isSmallIOS,a7 as isSupportWebHid,a3 as personalSign,R as registerNetworkWithMetamask,Z as sendTransaction,a4 as sign,a5 as signTransaction,a6 as signTypedData,n as standaloneList,w as standaloneListObject,u as useWalletStore,a2 as watchTx}from"./index-
|
|
1
|
+
export{t as ChainId,H as HD_PATH_LIST,O as OpenBlockIframeWallet,W as WalletType,V as WatchResult,o as allWalletList,a1 as approve,c as convertTransactionType,a as convertWeb3Provider,C as default,J as getBloctoConnector,E as getBloctoPackage,$ as getContract,P as getCyberConnector,G as getCyberPackage,X as getEstimateGas,Y as getGasPrice,y as getGnosisPackage,a8 as getIsAndroid,b as getIsIOS,g as getIsMobile,U as getIsOpenBlockIframe,r as getIsolatedEnvironmentWallet,x as getLedgerUSBPackage,T as getOpenBlockIframeConnector,K as getPortisConnector,A as getPortisPackage,a0 as getProviderByChain,F as getRainbowConnectPackage,N as getRainbowConnector,z as getUAuthPackage,Q as getUniPassConnector,I as getUniPassPackage,M as getWalletConnectConnector,D as getWalletConnectPackage,p as getWalletDisabledState,L as getWalletLinkConnector,B as getWalletLinkPackage,q as getWalletList,ab as getWindow,i as injectedConnect,m as injectedList,v as injectedListObject,ac as isAddress,aa as isLargeIOS,a9 as isSmallIOS,a7 as isSupportWebHid,a3 as personalSign,R as registerNetworkWithMetamask,Z as sendTransaction,a4 as sign,a5 as signTransaction,a6 as signTypedData,n as standaloneList,w as standaloneListObject,u as useWalletStore,a2 as watchTx}from"./index-2597cffd.js";import"@cyberlab/cyber-app-sdk";import"@ethersproject/providers";import"zustand";import"@ethersproject/constants";import"@ethersproject/contracts";import"@ethersproject/address";import"@ethersproject/properties";import"@ethersproject/transactions";import"@ethersproject/keccak256";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{_ as r,a as e}from"./index-
|
|
1
|
+
import{_ as r,a as e}from"./index-2597cffd.js";import o from"@portis/web3";import"@cyberlab/cyber-app-sdk";import"@ethersproject/providers";import"zustand";import"@ethersproject/constants";import"@ethersproject/contracts";import"@ethersproject/address";import"@ethersproject/properties";import"@ethersproject/transactions";import"@ethersproject/keccak256";function t({chainId:t,portisParams:i},n){return r(this,void 0,void 0,(function*(){if(!(null==i?void 0:i.id))throw new Error("uAuthParams is not valid.");let r="";switch(t){case 1:default:r="mainnet";break;case 5:r="goerli"}const s=new o(i.id,r,i.config);return yield s.provider.enable(),s.provider._portis=s,s.provider.on("connect",n.connect),s.provider.on("disconnect",n.disconnect),s.provider.on("accountsChanged",n.accountsChanged),s.provider.on("chainChanged",n.chainChanged),s.provider.on("message",n.message),e(s.provider)}))}export{t as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{_ as e}from"./index-
|
|
1
|
+
import{_ as e}from"./index-2597cffd.js";import"@cyberlab/cyber-app-sdk";import"@ethersproject/providers";import"zustand";import"@ethersproject/constants";import"@ethersproject/contracts";import"@ethersproject/address";import"@ethersproject/properties";import"@ethersproject/transactions";import"@ethersproject/keccak256";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 +1 @@
|
|
|
1
|
-
import{_ as e,g as o,b as t,a as n}from"./index-
|
|
1
|
+
import{_ as e,g as o,b as t,a as n}from"./index-2597cffd.js";import{EthereumProvider as r}from"@walletconnect/ethereum-provider";import"@ethersproject/address";import"@cyberlab/cyber-app-sdk";import"@ethersproject/providers";import"zustand";import"@ethersproject/constants";import"@ethersproject/contracts";import"@ethersproject/properties";import"@ethersproject/transactions";import"@ethersproject/keccak256";function c({chainId:c,rpcUrl:a,rpc:i,walletConnectParams:s,darkMode:d},p){return e(this,void 0,void 0,(function*(){let l,h,m="wss://relay.walletconnect.com",u=!0;s&&(m=s.bridge||m,u=void 0!==s.qrcode?s.qrcode:u,s.infuraId,h=s.qrModalOptions||void 0),i?l=i:c&&a&&(l={[c]:a});const b=o(),f=yield r.init({projectId:"59e050d1f27ed617e65bb9637c9498d6",chains:c?[c]:[],showQrModal:!b,rpcMap:l,qrModalOptions:Object.assign({themeMode:d?"dark":"light"},h)});return f.on("display_uri",(e=>{(null==h?void 0:h.openCallback)&&h.openCallback(e)})),f.on("connect",p.connect),f.on("disconnect",(e=>{p.disconnect(e),p.accountsChanged([])})),f.on("accountsChanged",p.accountsChanged),f.on("chainChanged",p.chainChanged),f.on("message",(({type:e,data:o})=>p.message(e,o))),new Promise((o=>e(this,void 0,void 0,(function*(){b?(f.once("display_uri",(e=>{let r=e;t()&&(r=`rainbow://wc?uri=${encodeURIComponent(e)}&connector=rainbowkit`),window.location.href=r,o(n(f))})),f.enable()):(yield f.enable(),o(n(f)))}))))}))}export{c as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{_ as t,i as e}from"./index-
|
|
1
|
+
import{_ as t,i as e}from"./index-2597cffd.js";import r from"@uauth/js";import"@cyberlab/cyber-app-sdk";import"@ethersproject/providers";import"zustand";import"@ethersproject/constants";import"@ethersproject/contracts";import"@ethersproject/address";import"@ethersproject/properties";import"@ethersproject/transactions";import"@ethersproject/keccak256";let o,i=!1;function n(n,s){return t(this,void 0,void 0,(function*(){if(i)return;const{uAuthParams:t}=n;if(!(null==t?void 0:t.clientID))throw new Error("uAuthParams is not valid.");i=!0;try{const n=Object.assign(Object.assign({},t),{redirectUri:t.redirectUri||window.location.origin});let l,c;o=new r(n);try{l=yield o.user()}catch(t){if(!o.fallbackLoginOptions.scope.includes("wallet"))throw new Error('Must request the "wallet" scope for connector to work.');if(n.shouldLoginWithRedirect)throw yield o.login(),yield new Promise((()=>{})),new Error("Should never get here.");yield o.loginWithPopup(),l=yield o.user()}if(null==l.wallet_type_hint)throw new Error("no wallet type present");if(["web3","injected"].includes(l.wallet_type_hint))c=e(void 0,s);else{if("walletconnect"!==l.wallet_type_hint||!n.walletConnect)throw new Error("Connector not supported");c=n.walletConnect()}return i=!1,c}catch(t){i=!1}}))}function s(){return null==o?void 0:o.logout()}export{n as default,s as disconnectWallet};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{_ as e,a as o}from"./index-
|
|
1
|
+
import{_ as e,a as o}from"./index-2597cffd.js";import{EthereumProvider as t}from"@walletconnect/ethereum-provider";import"@cyberlab/cyber-app-sdk";import"@ethersproject/providers";import"zustand";import"@ethersproject/constants";import"@ethersproject/contracts";import"@ethersproject/address";import"@ethersproject/properties";import"@ethersproject/transactions";import"@ethersproject/keccak256";function r({chainId:r,rpcUrl:n,rpc:c,walletConnectParams:a,darkMode:s},i){return e(this,void 0,void 0,(function*(){let e,d,p="wss://relay.walletconnect.com",l=!0;a&&(p=a.bridge||p,l=void 0!==a.qrcode?a.qrcode:l,a.infuraId,d=a.qrModalOptions||void 0),c?e=c:r&&n&&(e={[r]:n});const h=yield t.init({projectId:"59e050d1f27ed617e65bb9637c9498d6",chains:r?[r]:[],showQrModal:!0,rpcMap:e,qrModalOptions:Object.assign({themeMode:s?"dark":"light"},d)});return h.on("display_uri",(e=>{(null==d?void 0:d.openCallback)&&d.openCallback(e)})),yield h.enable(),h.on("connect",i.connect),h.on("disconnect",(e=>{i.disconnect(e),i.accountsChanged([])})),h.on("accountsChanged",i.accountsChanged),h.on("chainChanged",i.chainChanged),h.on("message",(({type:e,data:o})=>i.message(e,o))),o(h)}))}export{r as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{_ as e,i as r,a as o}from"./index-
|
|
1
|
+
import{_ as e,i as r,a as o}from"./index-2597cffd.js";import t from"@coinbase/wallet-sdk";import"@cyberlab/cyber-app-sdk";import"@ethersproject/providers";import"zustand";import"@ethersproject/constants";import"@ethersproject/contracts";import"@ethersproject/address";import"@ethersproject/properties";import"@ethersproject/transactions";import"@ethersproject/keccak256";function n({chainId:n,rpcUrl:a,appName:i,appLogoUrl:s,darkMode:c},p){return e(this,void 0,void 0,(function*(){if(window.ethereum&&(window.ethereum.isWalletLink||window.ethereum.isToshi))return r(window.ethereum,p);if(!i)throw new Error("walletLink need appName");const e=new t({appName:i,appLogoUrl:s,darkMode:c}).makeWeb3Provider(a,n);return yield e.enable(),e.on("connect",p.connect),e.on("disconnect",p.disconnect),e.on("accountsChanged",p.accountsChanged),e.on("chainChanged",p.chainChanged),e.on("message",p.message),o(e)}))}export{n as default};
|