Skip to content

Commit

Permalink
pages/Send: add default fee
Browse files Browse the repository at this point in the history
An upcoming change to Emerald will require a minimum gas price.
  • Loading branch information
pro-wh committed Jan 20, 2022
1 parent c65286b commit e0c9819
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/popup/pages/Send/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ class SendPage extends React.Component {
let runtimeType = params.accountType||""
let runtimeDecimals = params.decimals||cointypes.decimals
let isWithdraw = false
let defaultFeeAmount = "0"


let confirmTitle = ""
Expand Down Expand Up @@ -137,6 +138,9 @@ class SendPage extends React.Component {
toAddressCanInputDefaultValue = currentAccount.address
sendAction = WALLET_SEND_RUNTIME_WITHDRAW
}
// A wild guess: the minimum gas price on Emerald (10 nano ROSE) times the default loose
// overestimate of the gas (50k).
defaultFeeAmount = "500000"
}

pageTitle = getLanguage('send')
Expand Down Expand Up @@ -207,6 +211,7 @@ class SendPage extends React.Component {
toAddressShowValue,
runtimeType,
runtimeId,
defaultFeeAmount,
confirmTitle,
confirmToAddressTitle,
sendAction,
Expand Down Expand Up @@ -541,7 +546,7 @@ class SendPage extends React.Component {
return
}

feeAmount = feeAmount || 0
feeAmount = feeAmount || this.pageConfig.defaultFeeAmount
feeGas = feeGas || 0
let payFee = new BigNumber(amountDecimals(feeAmount)).toString()

Expand Down Expand Up @@ -622,7 +627,7 @@ class SendPage extends React.Component {
let nonce = trimSpace(this.state.nonce) || accountInfo.nonce
let fromAddress = currentAccount.address

let feeAmount = trimSpace(this.state.feeAmount)
let feeAmount = trimSpace(this.state.feeAmount) || this.pageConfig.defaultFeeAmount
let feeGas = trimSpace(this.state.feeGas)

let depositAddress = ""
Expand Down Expand Up @@ -734,7 +739,7 @@ class SendPage extends React.Component {
let netNonce = isNumber(accountInfo.nonce) ? accountInfo.nonce : ""
let nonce = this.state.nonce ? this.state.nonce : netNonce

let feeAmount = this.state.feeAmount ? this.state.feeAmount : 0
let feeAmount = this.state.feeAmount ? this.state.feeAmount : this.pageConfig.defaultFeeAmount
feeAmount = toNonExponential(amountDecimals(feeAmount, cointypes.decimals))
let title = ""
let toTitle = ""
Expand Down

0 comments on commit e0c9819

Please sign in to comment.