Skip to content
1,270 changes: 942 additions & 328 deletions package-lock.json

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,13 @@
"author": "Chance Hudson",
"license": "MIT",
"dependencies": {
"@ethersproject/bignumber": "5.7.0",
"axios": "^0.20.0",
"compression": "^1.7.4",
"dayjs": "^1.10.6",
"especial": "0.0.4",
"eth-ens-namehash": "^2.0.8",
"ethers": "5.7.2",
"express": "^4.17.1",
"js-sha512": "^0.8.0",
"lottie-web": "^5.8.1",
Expand Down
16 changes: 9 additions & 7 deletions src/Deposit.vue
Original file line number Diff line number Diff line change
Expand Up @@ -112,13 +112,12 @@ import Vue from 'vue'
import Component from 'vue-class-component'
import AssetDropdown from './components/AssetDropdown'
import AssetAmountField from './components/AssetAmountField'
import { toWei, fromWei } from './utils/wei'
import { ethers } from 'ethers'
import Checkbox from './components/Checkbox'
import BN from 'bn.js'
import { BigNumber } from "@ethersproject/bignumber";
import CenteredLeftMenu from './components/CenteredLeftMenu'
import NextButton from './components/NextButton'
import ConfirmDepositPopup from './components/ConfirmDepositPopup'
import measureText from './utils/measure-text'
import tooltips from './tooltips'
import InfoText from './components/InfoText'
import decimalCount from './utils/decimal-count'
Expand Down Expand Up @@ -150,6 +149,7 @@ export default class Deposit extends Vue {
depositType = 0
showingDepositConfirm = false
activeFeePromise = undefined
ethers = ethers

mounted() {
const { type, asset } = this.$route.query
Expand All @@ -169,20 +169,22 @@ export default class Deposit extends Vue {
}

async setFeeAmount(clickedButton) {
const multiplier = clickedButton === 'Fast' ? new BN('200000') : new BN('100000')
const multiplier = clickedButton === 'Fast' ? BigNumber.from('200000') : BigNumber.from('100000')
this.feeAmountState = 3
let feePromise
try {
const feePromise = this.$store.dispatch('loadCurrentWeiPerByte')
feePromise = this.$store.dispatch('loadCurrentWeiPerByte')
this.activeFeePromise = feePromise
const weiPerByte = await feePromise
if (this.activeFeePromise !== feePromise) return
this.activeFeePromise = undefined
// Assume 2000 bytes for a simple deposit tx in a block
const feeWeiAmount = new BN(weiPerByte).mul(multiplier)
const feeWeiAmount = BigNumber.from(weiPerByte.toString()).mul(multiplier)
console.log(feeWeiAmount)
this.feeAmount = ''
Vue.nextTick(() => {
if (this.activeFeePromise !== undefined) return
this.feeAmount = fromWei(feeWeiAmount, 9).toString()
this.feeAmount = ethers.utils.formatEther(feeWeiAmount)
})
} catch (err) {
if (this.activeFeePromise === feePromise) this.activeFeePromise = undefined
Expand Down
Loading