Skip to content

Commit

Permalink
Merge branch 'master' of github.com:zcashfoundation/zecwallet
Browse files Browse the repository at this point in the history
  • Loading branch information
adityapk00 committed Nov 4, 2020
2 parents f781c52 + d049ba7 commit ee693d7
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 8 deletions.
15 changes: 11 additions & 4 deletions app/components/Send.js
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,8 @@ function getSendManyJSON(sendPageState: SendPageState): [] {
}
})
);
json.push(1); // minconf = 1
json.push(Utils.getDefaultFee()); // Control the default fee as well.

console.log('Sending:');
console.log(json);
Expand Down Expand Up @@ -229,7 +231,9 @@ const ConfirmModalInternal = ({
openErrorModal,
history
}) => {
const sendingTotal = sendPageState.toaddrs.reduce((s, t) => parseFloat(s) + parseFloat(t.amount), 0.0) + 0.0001;
const sendingTotal =
sendPageState.toaddrs.reduce((s, t) => parseFloat(s) + parseFloat(t.amount), 0.0) +
Utils.getDefaultFee(info.latestBlock);
const { bigPart, smallPart } = Utils.splitZecAmountIntoBigSmall(sendingTotal);

const sendButton = () => {
Expand Down Expand Up @@ -301,7 +305,10 @@ const ConfirmModalInternal = ({
))}
</div>

<ConfirmModalToAddr toaddr={{ to: 'Fee', amount: 0.0001, memo: null }} info={info} />
<ConfirmModalToAddr
toaddr={{ to: 'Fee', amount: Utils.getDefaultFee(info.latestBlock), memo: null }}
info={info}
/>

{info && info.disconnected && (
<div className={[cstyles.red, cstyles.margintoplarge].join(' ')}>
Expand Down Expand Up @@ -443,7 +450,7 @@ export default class Send extends PureComponent<Props, SendState> {
};

setMaxAmount = (id: number, total: number) => {
const { sendPageState, setSendPageState } = this.props;
const { sendPageState, setSendPageState, info } = this.props;

const newToAddrs = sendPageState.toaddrs.slice(0);

Expand All @@ -452,7 +459,7 @@ export default class Send extends PureComponent<Props, SendState> {
.reduce((s, a) => parseFloat(s) + parseFloat(a.amount), 0);

// Add Fee
totalOtherAmount += Utils.getDefaultFee();
totalOtherAmount += Utils.getDefaultFee(info.latestBlock);

// Find the correct toAddr
const toAddr = newToAddrs.find(a => a.id === id);
Expand Down
5 changes: 3 additions & 2 deletions app/components/Transactions.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import Utils from '../utils/utils';
import AddressBook from './Addressbook';
import routes from '../constants/routes.json';

const TxModalInternal = ({ modalIsOpen, tx, closeModal, currencyName, zecPrice, setSendTo, history }) => {
const TxModalInternal = ({ modalIsOpen, tx, info, closeModal, currencyName, zecPrice, setSendTo, history }) => {
let txid = '';
let type = '';
let typeIcon = '';
Expand Down Expand Up @@ -54,7 +54,7 @@ const TxModalInternal = ({ modalIsOpen, tx, closeModal, currencyName, zecPrice,
};

const doReply = (address: string) => {
setSendTo(new ZcashURITarget(address, 0.0001, null));
setSendTo(new ZcashURITarget(address, Utils.getDefaultFee(info.latestBlock), null));
closeModal();

history.push(routes.SEND);
Expand Down Expand Up @@ -336,6 +336,7 @@ export default class Transactions extends Component<Props, State> {
<TxModal
modalIsOpen={modalIsOpen}
tx={clickedTx}
info={info}
closeModal={this.closeModal}
currencyName={info.currencyName}
zecPrice={info.zecPrice}
Expand Down
8 changes: 6 additions & 2 deletions app/utils/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,12 @@ export default class Utils {
return Utils.nextToAddrID++;
}

static getDefaultFee(): number {
return 0.0001;
static getDefaultFee(height: number): number {
if (height > 1046400) {
return 0.00001;
} else {
return 0.0001;
}
}

static getDonationAddress(testnet: boolean): string {
Expand Down

0 comments on commit ee693d7

Please sign in to comment.