Skip to content

Commit

Permalink
upgraded to beta.48 waiting for web3/web3.js#2441
Browse files Browse the repository at this point in the history
  • Loading branch information
kvhnuke committed Mar 7, 2019
1 parent dd90511 commit 2e4536b
Show file tree
Hide file tree
Showing 22 changed files with 539 additions and 500 deletions.
792 changes: 396 additions & 396 deletions package-lock.json

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -102,19 +102,19 @@
"trezor-connect": "7.0.1",
"u2f-api": "1.0.10",
"uglify-es": "3.3.9",
"underscore": "1.9.1",
"unused-files-webpack-plugin": "3.4.0",
"uuid": "3.3.2",
"vue-i18n": "8.8.2",
"vue-tel-input": "2.0.16",
"vue-template-compiler": "2.6.7",
"vue-worker": "1.2.1",
"wallet-address-validator": "0.2.4",
"web3": "1.0.0-beta.37",
"web3-core-helpers": "1.0.0-beta.37",
"web3-core-method": "1.0.0-beta.37",
"web3-core-requestmanager": "1.0.0-beta.37",
"web3-providers-http": "1.0.0-beta.37",
"web3-utils": "1.0.0-beta.37",
"web3": "1.0.0-beta.48",
"web3-core-helpers": "1.0.0-beta.48",
"web3-core-method": "1.0.0-beta.48",
"web3-providers": "1.0.0-beta.48",
"web3-utils": "1.0.0-beta.48",
"webpack": "4.28.4",
"worker-loader": "2.0.0",
"zxcvbn": "4.4.2"
Expand Down
1 change: 1 addition & 0 deletions src/dapps/BuySubdomain/BuySubdomain.vue
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ import { mapGetters } from 'vuex';
import _ from 'underscore';
import StandardButton from '@/components/Buttons/StandardButton';
import { Toast } from '@/helpers';
import { fromWei, sha3 } from 'web3-utils';
export default {
components: {
Expand Down
9 changes: 5 additions & 4 deletions src/dapps/SecureTransaction/SecureTransaction.vue
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,8 @@ import InterfaceBottomText from '@/components/InterfaceBottomText';
import Blockie from '@/components/Blockie';
import BigNumber from 'bignumber.js';
import * as unit from 'ethjs-unit';
import utils from 'web3-utils';
import { fromWei } from 'web3-utils';
import _ from 'underscore';
import { Toast, Misc } from '@/helpers';
export default {
Expand Down Expand Up @@ -251,7 +252,7 @@ export default {
);
},
transactionFee() {
return this.web3.utils.fromWei(
return fromWei(
new BigNumber(this.gasAmount)
.times(CoralConfig.gasLimitSuggestion)
.toFixed(0),
Expand All @@ -267,7 +268,7 @@ export default {
this.web3.eth
.getBalance(coinbase)
.then(res => {
this.balance = this.web3.utils.fromWei(res, 'ether');
this.balance = fromWei(res, 'ether');
this.$store.dispatch('setAccountBalance', res);
})
.catch(err => {
Expand All @@ -289,7 +290,7 @@ export default {
this.gasAmount = this.gasPrice;
},
methods: {
debouncedAmount: utils._.debounce(function(e) {
debouncedAmount: _.debounce(function(e) {
this.amount = e.target.value;
if (this.validAmount) this.getSafeSendFee();
}, 501),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -245,10 +245,10 @@
import CustomerSupport from '@/components/CustomerSupport';
import { mapGetters } from 'vuex';
import { Misc, Toast } from '@/helpers';
import web3utils from 'web3-utils';
import BigNumber from 'bignumber.js';
import Blockie from '@/components/Blockie';
import { fromWei } from 'web3-utils';
import _ from 'underscore';
const MAX_ADDRESSES = 5;
export default {
components: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ export default {
worker.onerror = function(e) {
e.preventDefault();
self.spinner = false;
console.log(e);
Toast.responseHandler(e, Toast.ERROR);
};
} else {
Expand Down
4 changes: 2 additions & 2 deletions src/layouts/ConvertUnits/components/UnitInput/UnitInput.vue
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
import { BigNumber } from 'bignumber.js';
import { mapGetters } from 'vuex';
import DropDownUnitSelector from '../DropDownUnitSelector';
import utils from 'web3-utils';
import * as ethjsUnit from 'ethjs-unit';
export default {
components: {
Expand Down Expand Up @@ -102,7 +102,7 @@ export default {
methods: {
getValueOfUnit(unit) {
unit = unit ? unit.toLowerCase() : 'ether';
const unitValue = utils.unitMap[unit];
const unitValue = ethjsUnit.unitMap[unit];
return new BigNumber(unitValue, 10);
},
convertFromTo(amt, from, to) {
Expand Down
12 changes: 8 additions & 4 deletions src/layouts/InterfaceLayout/InterfaceLayout.vue
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@

<script>
import { mapGetters } from 'vuex';
import Ens from 'ethereum-ens';
import ENS from 'ethereum-ens';
import WalletPasswordModal from '@/components/WalletPasswordModal';
import EnterPinNumberModal from '@/components/EnterPinNumberModal';
import NetworkAndAddressModal from '@/layouts/AccessWalletLayout/components/NetworkAndAddressModal';
Expand All @@ -115,7 +115,7 @@ import store from 'store';
import TokenBalance from '@myetherwallet/eth-token-balance';
import sortByBalance from '@/helpers/sortByBalance.js';
import AddressQrcodeModal from '@/components/AddressQrcodeModal';
import web3Utils from 'web3-utils';
import _ from 'underscore';
import {
LedgerWallet,
TrezorWallet,
Expand All @@ -132,7 +132,7 @@ import {
KEEPKEY as KEEPKEY_TYPE,
MNEMONIC as MNEMONIC_TYPE
} from '@/wallets/bip44/walletTypes';
import { sha3, fromWei, toBN } from 'web3-utils';
import { fromWei } from 'web3-utils';
export default {
name: 'Interface',
components: {
Expand Down Expand Up @@ -508,7 +508,7 @@ export default {
clearInterval(this.pollNetwork);
clearInterval(this.pollAddress);
},
setupOnlineEnvironment: web3Utils._.debounce(function() {
setupOnlineEnvironment: _.debounce(function() {
this.clearIntervals();
if (store.get('customTokens') === undefined) {
store.set('customTokens', {});
Expand Down Expand Up @@ -545,6 +545,10 @@ export default {
})
.on('data', headers => {
this.blockNumber = headers.number;
})
.catch(() => {
subscription = setInterval(this.getBlock, 14000);
resolve(subscription);
});
});
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ import { mapGetters } from 'vuex';
import { Toast } from '@/helpers';
import InterfaceTokensModal from '../InterfaceTokensModal';
import sortByBalance from '@/helpers/sortByBalance.js';
import utils from 'web3-utils';
import { toChecksumAddress } from '@/helpers/addressUtils';
import * as networkTypes from '@/networks/types';
export default {
Expand Down Expand Up @@ -133,7 +133,6 @@ export default {
search: '',
localTokens: [],
customTokens: [],
util: utils,
tokenExists: false
};
},
Expand Down Expand Up @@ -224,17 +223,11 @@ export default {
},
searchByAddr(addr) {
const searchNetwork = this.localTokens.find(item => {
return (
utils.toChecksumAddress(item.address) ===
utils.toChecksumAddress(addr)
);
return toChecksumAddress(item.address) === toChecksumAddress(addr);
});
const searchCustom = this.customTokens.find(item => {
return (
utils.toChecksumAddress(item.address) ===
utils.toChecksumAddress(addr)
);
return toChecksumAddress(item.address) === toChecksumAddress(addr);
});
if (searchNetwork !== undefined || searchCustom !== undefined) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -426,6 +426,7 @@ export default {
const json = _tx.toJSON(true);
json.from = coinbase;
this.web3.eth.sendTransaction(json).catch(err => {
console.log(err);
Toast.responseHandler(err, Toast.ERROR);
});
} catch (e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ import { mapGetters } from 'vuex';
import { isAddress } from '@/helpers/addressUtils';
import store from 'store';
import { Misc, Toast } from '@/helpers';
import utils from 'web3-utils';
import _ from 'underscore';
export default {
components: {
Expand Down Expand Up @@ -320,7 +320,7 @@ export default {
}
},
methods: {
debouncedAmount: utils._.debounce(function(e) {
debouncedAmount: _.debounce(function(e) {
const decimals =
this.selectedCoinType.symbol === this.network.type.name
? 18
Expand Down
8 changes: 4 additions & 4 deletions src/layouts/SendOfflineHelper/SendOfflineHelper.vue
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,7 @@ import ethTx from 'ethereumjs-tx';
import { mapGetters } from 'vuex';
import Misc from '@/helpers/misc';
import BigNumber from 'bignumber.js';
import web3Utils from 'web3-utils';
import { fromWei, toWei } from 'web3-utils';
import * as networkTypes from '@/networks/types';
import TitleTextContentsLayout from '@/layouts/InformationPages/Components/TitleTextContentsLayout';
Expand Down Expand Up @@ -548,15 +548,15 @@ export default {
},
toEth(val) {
if (!val || isNaN(val)) return 0;
return web3Utils.fromWei(new BigNumber(val).toFixed(), 'ether');
return fromWei(new BigNumber(val).toFixed(), 'ether');
},
toWei(val) {
if (!val) return 0;
return web3Utils.toWei(new BigNumber(val).toFixed(), 'gwei');
return toWei(new BigNumber(val).toFixed(), 'gwei');
},
toGwei(val) {
if (!val) return 0;
return web3Utils.fromWei(new BigNumber(val).toFixed(), 'gwei');
return fromWei(new BigNumber(val).toFixed(), 'gwei');
},
dateTimeDisplay(unixTimeStamp) {
return new Date(unixTimeStamp).toString();
Expand Down
40 changes: 20 additions & 20 deletions src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,23 +105,23 @@ const vue = new Vue({
render: h => h(getApp())
}).$mount('#app');

Sentry.init({
dsn: 'https://2c4e977d74fd44d1b18083e63a3b265f@sentry.mewapi.io/1',
integrations: [new Sentry.Integrations.Vue({ vue })],
maxBreadcrumbs: 0,
environment: BUILD_TYPE,
requestBodies: 'small',
release: NODE_ENV === 'production' ? VERSION : 'develop',
beforeSend(event) {
event.tags = {
network: store.getters.network.type.name,
service: store.getters.network.service,
walletType: store.getters.account.identifier
};
return new Promise(resolve => {
vue.$eventHub.$emit('issueModal', event, resolve);
}).then(res => {
return res === true ? event : null;
});
}
});
// Sentry.init({
// dsn: 'https://2c4e977d74fd44d1b18083e63a3b265f@sentry.mewapi.io/1',
// integrations: [new Sentry.Integrations.Vue({ vue })],
// maxBreadcrumbs: 0,
// environment: BUILD_TYPE,
// requestBodies: 'small',
// release: NODE_ENV === 'production' ? VERSION : 'develop',
// beforeSend(event) {
// event.tags = {
// network: store.getters.network.type.name,
// service: store.getters.network.service,
// walletType: store.getters.account.identifier
// };
// return new Promise(resolve => {
// vue.$eventHub.$emit('issueModal', event, resolve);
// }).then(res => {
// return res === true ? event : null;
// });
// }
// });
10 changes: 5 additions & 5 deletions src/wallets/web3-provider/methods/eth_getTransactionCount.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { sha3, toHex } from 'web3-utils';
import { sha3 } from 'web3-utils';
import { toPayload } from './jsonrpc';
import EthCalls from '../web3Calls';
import store from 'store';
Expand All @@ -10,14 +10,14 @@ export default async ({ payload, requestManager }, res, next) => {
const ethCalls = EthCalls(requestManager);
const addr = payload.params[0];
let cached = {};
if (store.get(utils.sha3(addr)) === undefined) {
if (store.get(sha3(addr)) === undefined) {
cached = {
nonce: '0x00',
timestamp: 0
};
store.set(utils.sha3(addr), cached);
store.set(sha3(addr), cached);
} else {
cached = store.get(utils.sha3(addr));
cached = store.get(sha3(addr));
}
const timeDiff =
Math.round((new Date().getTime() - cached.timestamp) / 1000) / 60;
Expand All @@ -36,7 +36,7 @@ export default async ({ payload, requestManager }, res, next) => {
timestamp: +new Date()
};
}
store.set(utils.sha3(addr), cached);
store.set(sha3(addr), cached);
}
res(null, toPayload(payload.id, cached.nonce));
};
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,13 @@ export default async ({ payload, requestManager }, res, next) => {
timestamp: new Date().getTime(),
receipt: JSON.stringify(receipt)
};
console.log('MISS', JSON.stringify(receipt));
res(null, toPayload(payload.id, receipt));
} catch (e) {
res(null, toPayload(payload.id, null));
}
} else {
console.log('HIT', memcache[txHash].receipt);
res(
null,
toPayload(payload.id, JSON.parse(memcache[txHash].receipt) || null)
Expand Down
6 changes: 3 additions & 3 deletions src/wallets/web3-provider/methods/eth_sendTransaction.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import unit from 'ethjs-unit';
import utils from 'web3-utils';
import { sha3 } from 'web3-utils';
import EthCalls from '../web3Calls';
import { WEB3_WALLET } from '../../bip44/walletTypes';
import EventNames from '../events';
Expand Down Expand Up @@ -61,10 +61,10 @@ export default async (
.once('transactionHash', hash => {
if (store.state.wallet !== null) {
const localStoredObj = locStore.get(
utils.sha3(store.state.wallet.getChecksumAddressString())
sha3(store.state.wallet.getChecksumAddressString())
);
locStore.set(
utils.sha3(store.state.wallet.getChecksumAddressString()),
sha3(store.state.wallet.getChecksumAddressString()),
{
nonce: Misc.sanitizeHex(
new BigNumber(localStoredObj.nonce).plus(1).toString(16)
Expand Down
4 changes: 2 additions & 2 deletions src/wallets/web3-provider/methods/eth_sign.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import EventNames from '../events';
import { toPayload } from './jsonrpc';
import utils from 'web3-utils';
import { hexToUtf8 } from 'web3-utils';
export default async ({ payload, eventHub }, res, next) => {
if (payload.method !== 'eth_sign') return next();
let msg;
try {
msg = utils.hexToUtf8(payload.params[1]);
msg = hexToUtf8(payload.params[1]);
} catch (e) {
msg = payload.params[1];
}
Expand Down
2 changes: 1 addition & 1 deletion src/wallets/web3-provider/methods/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const getSanitizedTx = tx => {
);

try {
tx = formatters.inputCallFormatter(tx);
tx = formatters.inputCallFormatter(tx, {});
const transaction = tx;
if (tx.to) transaction.to = tx.to;
transaction.data = tx.data || '0x';
Expand Down
Loading

0 comments on commit 2e4536b

Please sign in to comment.