Skip to content

Commit

Permalink
Merge pull request #2628 from SelfKeyFoundation/release
Browse files Browse the repository at this point in the history
Release 1.9.11
  • Loading branch information
andregoncalves authored Aug 29, 2021
2 parents b37c6eb + abe5a09 commit 85af64f
Show file tree
Hide file tree
Showing 19 changed files with 48 additions and 29 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "selfkey-identity-wallet",
"productName": "SelfKey Identity Wallet",
"version": "1.9.10",
"version": "1.9.11",
"description": "The Official SelfKey Identity Wallet for Desktop",
"browser": [
"chrome"
Expand Down
2 changes: 1 addition & 1 deletion src/common/contract/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ const operations = {
let gasPrice = afterUpdate.gasPrice;
if (!gasPrice) {
gasPrice = ethGasStationInfoSelectors.getEthGasStationInfo(getState())
.ethGasStationInfo.average;
.ethGasStationInfo.medium.suggestedMaxFeePerGas;
}

await dispatch(
Expand Down
12 changes: 7 additions & 5 deletions src/common/eth-gas-station/selectors.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
const GWEI = 1000000000;

export const getEthGasStationInfo = ({ ethGasStationInfo }) => ethGasStationInfo;
export const getEthGasStationInfoWEI = ({ ethGasStationInfo }) => ({
average: ethGasStationInfo.ethGasStationInfo.average * GWEI,
fast: ethGasStationInfo.ethGasStationInfo.fast * GWEI,
safeLow: ethGasStationInfo.ethGasStationInfo.safeLow * GWEI
});
export const getEthGasStationInfoWEI = ({ ethGasStationInfo }) => {
return {
medium: ethGasStationInfo.ethGasStationInfo.medium.suggestedMaxFeePerGas * GWEI,
high: ethGasStationInfo.ethGasStationInfo.high.suggestedMaxFeePerGas * GWEI,
low: ethGasStationInfo.ethGasStationInfo.low.suggestedMaxFeePerGas * GWEI
};
};
12 changes: 7 additions & 5 deletions src/common/marketplace/orders/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,7 @@ const preapproveCurrentOrderOperation = () => async (dispatch, getState) => {
config.paymentSplitterAddress,
amount,
allowanceGas,
gasPriceEstimates.average,
gasPriceEstimates.medium,
onTransactionHash
);
order = ordersSelectors.getOrder(getState(), orderId);
Expand Down Expand Up @@ -357,7 +357,9 @@ const directPayCurrentOrderOperation = ({ trezorAccountIndex }) => async (dispat
getState()
);
let order = ordersSelectors.getOrder(getState(), orderId);
const cryptoCurrency = order.cryptoCurrency;
const cryptoCurrency = order.cryptoCurrency
? order.cryptoCurrency
: config.constants.primaryToken;
const { ethGasStationInfo } = ethGasStationInfoSelectors.getEthGasStationInfo(getState());
const amount = new BN(order.amount).toFixed(18);

Expand Down Expand Up @@ -460,7 +462,7 @@ const payCurrentOrderOperation = () => async (dispatch, getState) => {
0,
0,
paymentGas,
gasPriceEstimates.average,
gasPriceEstimates.medium,
onTransactionHash
);
order = ordersSelectors.getOrder(getState(), orderId);
Expand Down Expand Up @@ -654,7 +656,7 @@ const ordersSelectors = {
getCurrentPaymentFeeEth: state => {
let gasPriceEstimates = ethGasStationInfoSelectors.getEthGasStationInfoWEI(state);
const { paymentGas } = ordersSelectors.getCurrentOrder(state) || {};
return new BN(gasPriceEstimates.average)
return new BN(gasPriceEstimates.medium)
.dividedBy(1000000000000000000)
.multipliedBy(paymentGas || 0)
.toString();
Expand All @@ -669,7 +671,7 @@ const ordersSelectors = {
getCurrentAllowanceFeeEth: state => {
let gasPriceEstimates = ethGasStationInfoSelectors.getEthGasStationInfoWEI(state);
const { allowanceGas } = ordersSelectors.getCurrentOrder(state) || {};
return new BN(gasPriceEstimates.average)
return new BN(gasPriceEstimates.medium)
.dividedBy(1000000000000000000)
.multipliedBy(allowanceGas || 0)
.toString();
Expand Down
4 changes: 2 additions & 2 deletions src/common/marketplaces/operations.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ export const startStakeTransactionOperation = (serviceOwner, serviceId, amount)
let tx = {
action: 'placeStake',
gasLimit,
gasPrice: currentTransaction.gasPriceEstimates.average,
gasPrice: currentTransaction.gasPriceEstimates.medium,
serviceOwner,
serviceId,
amount
Expand Down Expand Up @@ -126,7 +126,7 @@ export const startWithdrawTransactionOperation = (serviceOwner, serviceId) => as
let tx = {
action: 'withdrawStake',
gasLimit,
gasPrice: currentTransaction.gasPriceEstimates.average,
gasPrice: currentTransaction.gasPriceEstimates.medium,
serviceOwner,
serviceId
};
Expand Down
7 changes: 6 additions & 1 deletion src/common/marketplaces/selectors.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,12 @@ export const marketplacesSelectors = {
let fiat = fiatCurrencySelectors.getFiatCurrency(state);
let fiatRate = pricesSelectors.getRate(state, 'ETH', fiat.fiatCurrency);
let tx = this.marketplacesSelector(state).currentTransaction;
if (!tx) tx = { action: 'none', gasLimit: 0, gasPrice: gasPriceEstimates.average };
if (!tx)
tx = {
action: 'none',
gasLimit: 0,
gasPrice: gasPriceEstimates.medium
};
let fee = new BN(tx.gasPrice || 0).multipliedBy(tx.gasLimit || 0).toString();
let feeFiat = new BN(fee).multipliedBy(fiatRate).toString();
return { ...tx, gasPriceEstimates, fiat, fiatRate, fee, feeFiat };
Expand Down
2 changes: 1 addition & 1 deletion src/main/blockchain/web3-service.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,10 @@ export class Web3Service extends EventEmitter {
await this.web3.eth.getBlockNumber();
});
engine.on('block', block => this.emit('block', block));
engine.start();

this.web3 = new Web3(engine);
this.web3.transactionConfirmationBlocks = 1;
engine.start();
}

async switchToLedgerWallet(accountsOffset = 0, accountsQuantity = 6) {
Expand Down
2 changes: 1 addition & 1 deletion src/renderer/did/create-did-popup-container.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class CreateDIDPopupContainerComponent extends PureComponent {

getPaymentParameters = _ => {
const { ethRate, ethGasStationInfo, cryptoCurrency, gasLimit } = this.props;
const gasPrice = ethGasStationInfo.fast;
const gasPrice = ethGasStationInfo.medium.suggestedMaxFeePerGas;
const ethFee = EthUnits.toEther(gasPrice * gasLimit, 'gwei');
const usdFee = ethFee * ethRate;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class BankAccountsCheckoutContainer extends MarketplaceBankAccountsComponent {

getPaymentParameters() {
const { keyRate, ethRate, ethGasStationInfo, cryptoCurrency, jurisdiction } = this.props;
const gasPrice = ethGasStationInfo.fast;
const gasPrice = ethGasStationInfo.medium.suggestedMaxFeePerGas;
const price = jurisdiction.price;
const keyAmount = price / keyRate;
const gasLimit = FIXED_GAS_LIMIT_PRICE;
Expand Down
5 changes: 4 additions & 1 deletion src/renderer/marketplace/common/payment-checkout.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -200,9 +200,12 @@ const PaymentCheckout = withStyles(styles)(
style="currency"
value={usdFee}
className={classes.currency}
fractionDigits={2}
/>
</div>
<div className="time">{ethFee.toLocaleString()} ETH</div>
<div className="time">
{Number.parseFloat(ethFee).toFixed(8)} ETH{' '}
</div>
</div>
</Grid>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class IncorporationsCheckoutContainer extends MarketplaceIncorporationsComponent

getPaymentParameters() {
const { keyRate, ethRate, ethGasStationInfo, cryptoCurrency, program } = this.props;
const gasPrice = ethGasStationInfo.fast;
const gasPrice = ethGasStationInfo.medium.suggestedMaxFeePerGas;
const price = program.price;
const keyAmount = price / keyRate;
const gasLimit = FIXED_GAS_LIMIT_PRICE;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class IncorporationsPaymentContainer extends MarketplaceIncorporationsComponent

this.props.dispatch(
ordersOperations.startOrderOperation({
productInfo: `Incorporate in ${program.Region}`,
productInfo: `Incorporate in ${program.data.region}`,
applicationId: application.id,
amount: price,
vendorId,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ class IncorporationsListContainer extends MarketplaceIncorporationsComponent {
onDetailsClick = jurisdiction => {
const { companyCode, countryCode } = jurisdiction.data;
const { templateId, vendorId } = jurisdiction;

this.props.dispatch(
push(this.detailsRoute({ companyCode, countryCode, templateId, vendorId }))
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class MarketplaceKeyFiCheckoutContainerComponent extends MarketplaceKeyFiCompone

getPaymentParameters() {
const { keyRate, ethRate, ethGasStationInfo, cryptoCurrency, product } = this.props;
const gasPrice = ethGasStationInfo.fast;
const gasPrice = ethGasStationInfo.medium.suggestedMaxFeePerGas;
const price = product.price;
const ethPrice = price;
const keyPrice = price * 0.8;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ export const NotariesServiceCost = withStyles(style)(
$ {gasUsdFee.toLocaleString(undefined, { maximumFractionDigits: 2 })}
</Typography>
<Typography variant="subtitle2" color="secondary">
{gasEthFee} ETH
{Number.parseFloat(gasEthFee).toFixed(8)} ETH
</Typography>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ class RequestNotarizationContainer extends MarketplaceNotariesComponent {

getPaymentParameters() {
const { ethRate, ethGasStationInfo } = this.props;
const gasPrice = ethGasStationInfo.average;
const gasPrice = ethGasStationInfo.medium.suggestedMaxFeePerGas;
const gasLimit = FIXED_GAS_LIMIT_PRICE;
const gasEthFee = EthUnits.toEther(gasPrice * gasLimit, 'gwei');
const gasUsdFee = gasEthFee * ethRate;
Expand Down Expand Up @@ -147,7 +147,6 @@ class RequestNotarizationContainer extends MarketplaceNotariesComponent {
const mapStateToProps = (state, props) => {
const { templateId, vendorId, productId } = props.match.params;
const identity = identitySelectors.selectIdentity(state);

return {
templateId,
vendorId,
Expand Down
6 changes: 5 additions & 1 deletion src/renderer/marketplace/orders/payment-container.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { MarketplacePayment } from './payment';
import { ordersSelectors, ordersOperations } from '../../../common/marketplace/orders';
import { identitySelectors } from '../../../common/identity';
import { featureIsEnabled } from 'common/feature-flags';
import config from 'common/config';

const LEARN_HOW_URL = 'https://help.selfkey.org';

Expand All @@ -26,6 +27,9 @@ class MarketplacePaymentContainer extends PureComponent {
window.openExternal(e, LEARN_HOW_URL);
};
render() {
const cryptoCurrency = this.props.order.cryptoCurrency
? this.props.order.cryptoCurrency
: config.constants.primaryToken;
return (
<MarketplacePayment
onBackClick={this.handleBackClick}
Expand All @@ -37,7 +41,7 @@ class MarketplacePaymentContainer extends PureComponent {
did={this.props.identity.did}
vendorName={this.props.order.vendorName}
onLearnHowClick={this.handleLearnHowClick}
cryptoCurrency={this.props.order.cryptoCurrency}
cryptoCurrency={cryptoCurrency}
/>
);
}
Expand Down
7 changes: 5 additions & 2 deletions src/renderer/marketplace/orders/payment.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -171,10 +171,13 @@ export const MarketplacePayment = withStyles(styles)(
color="primary"
className={classes.bold}
>
$ {Number.parseFloat(feeUSD).toLocaleString()}
${' '}
{Number.parseFloat(feeUSD)
.toFixed(2)
.toLocaleString()}
</Typography>
<Typography variant="subtitle2" color="secondary">
{feeETH} ETH
{Number.parseFloat(feeETH).toFixed(8)} ETH
</Typography>
</Grid>
</Grid>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class PassportsCheckoutContainerComponent extends MarketplacePassportsComponent

getPaymentParameters() {
const { keyRate, ethRate, ethGasStationInfo, cryptoCurrency, program } = this.props;
const gasPrice = ethGasStationInfo.fast;
const gasPrice = ethGasStationInfo.medium.suggestedMaxFeePerGas;
const price = program.price;
const keyAmount = price / keyRate;
const gasLimit = FIXED_GAS_LIMIT_PRICE;
Expand Down

0 comments on commit 85af64f

Please sign in to comment.