diff --git a/js/dappModal.js b/js/dappModal.js index f940c2e..8aebf26 100644 --- a/js/dappModal.js +++ b/js/dappModal.js @@ -50,18 +50,15 @@ const addWalletBtnListener = (walletConnector, end, onLoginSuccess) => { // add listener once $('#use-metamask-btn').click(() => { if (!(windowProvider && windowProvider.isMetaMask)) { - console.debug('Can\'t find MetaMask'); myAlert.metamask(); return; } - console.debug('Use MetaMask'); window.ethereum = windowProvider; window.web3 = windowWeb3; modalStartLoading(); window.ethereum.enable().then((res) => { - console.debug('res: ', res); modalHide(); end(null, res); }).catch((err) => { @@ -71,16 +68,13 @@ const addWalletBtnListener = (walletConnector, end, onLoginSuccess) => { }); $('#use-dapper-btn').click(() => { if (!(windowProvider && windowProvider.isDapper)) { - console.debug('Can\'t find Dapper'); myAlert.dapper(); return; } - console.debug('Use Dapper'); // Check if Dapper is unclocked if (!(windowWeb3.eth.coinbase)) { - console.debug('Dapper is locked'); myAlert.dapperIsLocked(); return; } @@ -90,7 +84,6 @@ const addWalletBtnListener = (walletConnector, end, onLoginSuccess) => { modalStartLoading(); window.ethereum.enable().then((res) => { - console.debug('res: ', res); modalHide(); end(null, res); }).catch((err) => { @@ -99,7 +92,6 @@ const addWalletBtnListener = (walletConnector, end, onLoginSuccess) => { }); }); $('#use-portis-btn').click(() => { - console.debug('Use Portis'); const portis = new Portis('696237e9-38fb-406a-a4d6-bfa3a4d63293', config.network); const web3 = new Web3(portis.provider); @@ -109,7 +101,6 @@ const addWalletBtnListener = (walletConnector, end, onLoginSuccess) => { modalStartLoading(); window.ethereum.enable().then((res) => { - console.debug('res: ', res); modalHide(); end(null, res); }).catch((err) => { @@ -118,7 +109,6 @@ const addWalletBtnListener = (walletConnector, end, onLoginSuccess) => { }); }); $('#use-torus-btn').click(async () => { - console.debug('Use Torus'); // Optional, if ture, reload or restore website will keep user web3 data // const isTorus = sessionStorage.getItem('pageUsingTorus'); @@ -152,7 +142,6 @@ const addWalletBtnListener = (walletConnector, end, onLoginSuccess) => { } }); $('#use-ledger-btn').click(async () => { - console.debug('Use Ledger'); showLedgerDerivationPath(); $('#go-back').click(() => { ledgerPathGoBack(); @@ -167,7 +156,6 @@ const addWalletBtnListener = (walletConnector, end, onLoginSuccess) => { let accounts; try { accounts = await web3.eth.getAccounts(); - console.debug(accounts); // Set default Account const [firstAccount, ...rest] = accounts; web3.eth.defaultAccount = firstAccount; @@ -191,7 +179,6 @@ const addWalletBtnListener = (walletConnector, end, onLoginSuccess) => { let accounts; try { accounts = await web3.eth.getAccounts(); - console.debug(accounts); // Set default Account const [firstAccount, ...rest] = accounts; web3.eth.defaultAccount = firstAccount; @@ -230,7 +217,6 @@ const addWalletBtnListener = (walletConnector, end, onLoginSuccess) => { } }); $('#use-mobile-btn').click(() => { - console.debug('Use WalletConnect'); if (window.isMobile) { // Mobile myAlert.wcUnsupport(); @@ -247,7 +233,6 @@ const addWalletBtnListener = (walletConnector, end, onLoginSuccess) => { const { uri } = walletConnector; // display QR Code modal WalletConnectQRCodeModal.open(uri, () => { - console.debug('QR Code Modal closed'); }); }); @@ -290,7 +275,6 @@ module.exports = { // Add dismiss handler const listener = () => { - console.debug('On dappQrcodeModal close'); $('#dappQrcodeModal').off(); }; $('#dappQrcodeModal').on('hidden.bs.modal', listener); diff --git a/js/dappSdkProvider.js b/js/dappSdkProvider.js index b8e060d..0138a64 100644 --- a/js/dappSdkProvider.js +++ b/js/dappSdkProvider.js @@ -17,10 +17,8 @@ RemoteLoginSubprovider.prototype.handleRequest = function handleRequest(payload, switch (payload.method) { // enable case 'eth_requestAccounts': { - console.debug('******* enable(), eth_requestAccounts *******'); const { payload: { walletConnector } } = payload; - console.debug(walletConnector); dappModal.showLoginQrcodeWithString( walletConnector, @@ -36,13 +34,11 @@ RemoteLoginSubprovider.prototype.handleRequest = function handleRequest(payload, } case 'eth_coinbase': { - console.log('eth_coinbase'); end(null, self.defaultAddress); break; } case 'eth_accounts': { - console.log('eth_accounts'); end(null, [self.defaultAddress]); break; } @@ -53,17 +49,14 @@ RemoteLoginSubprovider.prototype.handleRequest = function handleRequest(payload, } const txData = payload.params[0]; - console.log('eth_sendTransaction txData: ', txData); self.walletConnector .sendTransaction(txData) .then((result) => { // Returns transaction id (hash) - console.log('result: ', result); end(null, result); }) .catch((error) => { // Error returned when rejected - console.log('error: ', error); end(error); }); break; @@ -74,7 +67,6 @@ RemoteLoginSubprovider.prototype.handleRequest = function handleRequest(payload, end(Error('Please login.')); } - console.log(payload.params); const { params: [address, data] } = payload; const msgParams = [ address, @@ -83,12 +75,10 @@ RemoteLoginSubprovider.prototype.handleRequest = function handleRequest(payload, self.walletConnector.signMessage(msgParams) .then((result) => { // Returns signature. - console.log('result: ', result); end(null, result); }) .catch((error) => { // Error returned when rejected - console.log('error: ', error); end(error); }); break; @@ -112,12 +102,10 @@ RemoteLoginSubprovider.prototype.handleRequest = function handleRequest(payload, self.walletConnector.signPersonalMessage(msgParams) .then((result) => { // Returns signature. - console.log('result: ', result); end(null, result); }) .catch((error) => { // Error returned when rejected - console.log('error: ', error); end(error); }); break; diff --git a/js/index.js b/js/index.js index b3c818d..7077031 100644 --- a/js/index.js +++ b/js/index.js @@ -16,7 +16,6 @@ let _defaultAddress; const { rpcUrl } = config; const getDefaultAddress = () => { - console.log('getDefaultAddress'); if (_defaultAddress !== undefined) { return _defaultAddress; } @@ -24,7 +23,6 @@ const getDefaultAddress = () => { }; const getNetVersion = () => { - console.log('getNetVersion'); return 1; }; @@ -75,7 +73,6 @@ const initEngine = () => { eng.dappSdk = { version }; eng.enable = async (cb = () => {}) => { - console.log('enable'); const p = new Promise((resolve, reject) => { const rpcData = { method: 'eth_requestAccounts', @@ -85,10 +82,8 @@ const initEngine = () => { }; eng.sendAsync(rpcData, (err, res) => { if (err) { - console.log('enable rejected with err: ', err); reject(err); } - console.log('enable resolved, res: ', res); defaultEnableCallback(err, res); cb(err, res); resolve(res); diff --git a/js/staticProvider.js b/js/staticProvider.js index c241bdd..b8fb92b 100644 --- a/js/staticProvider.js +++ b/js/staticProvider.js @@ -8,15 +8,12 @@ function StaticProvider(defaultAddressGenerator, defaulNetVersionGenerator) { self.staticResponses = { eth_accounts: () => { - console.log('****eth_accounts'); return [self.defaultAddressGenerator()]; }, eth_coinbase: () => { - console.log('****eth_coinbase'); return self.defaultAddressGenerator(); }, net_version: () => { - console.log('****net_version'); return self.defaulNetVersionGenerator(); }, }; @@ -31,13 +28,11 @@ StaticProvider.prototype.handleRequest = function handleRequest(payload, next, e StaticProvider.prototype.handleSyncRequest = function handleSyncRequest(payload) { const self = this; - console.log('payload.method: ', payload.method); const staticResponse = self.staticResponses[payload.method]; if (typeof staticResponse === 'function') { return staticResponse(); // static response - null is valid response } if (staticResponse !== undefined) { - console.log(staticResponse); return staticResponse; // no prepared response - skip } diff --git a/js/walletConnect.js b/js/walletConnect.js index ec6dbad..ab0b519 100644 --- a/js/walletConnect.js +++ b/js/walletConnect.js @@ -8,7 +8,6 @@ const setupWalletConnector = (walletConnector) => { // Get updated accounts and chainId const { accounts, chainId } = payload.params[0]; - console.debug('on session_update', accounts, chainId); }); walletConnector.on('disconnect', (error, payload) => { @@ -17,7 +16,6 @@ const setupWalletConnector = (walletConnector) => { } // Delete walletConnector - console.debug('on disconnect'); // eslint-disable-next-line no-alert alert('Log out successfully.'); // eslint-disable-next-line no-restricted-globals diff --git a/sample/sample.html b/sample/sample.html index 577de4f..5443922 100644 --- a/sample/sample.html +++ b/sample/sample.html @@ -177,7 +177,6 @@
ETH Amount
alert('Please use wallet connect.'); } else { window.ethereum.logout().then((res) => { - console.log('logout done. res: ', res); }).catch((err) => { alert(err); }); diff --git a/sample/server.js b/sample/server.js index 785a330..c127f81 100644 --- a/sample/server.js +++ b/sample/server.js @@ -7,10 +7,8 @@ var path = require('path'); function start(route) { var app = express(); - console.log('Server start...'); app.get('/', (req, res) => { - console.log("Request received."); fs.readFile('./sample/sample.html',(err, data) => { res.writeHead(200, {"Content-Type": "text/html", 'Content-Length':data.length}); res.write(data);