Skip to content

Commit

Permalink
Merge pull request #532 from rithvikvibhu/rc1-fixes
Browse files Browse the repository at this point in the history
1.0.0 RC1 fixes
  • Loading branch information
rithvikvibhu authored Jul 27, 2022
2 parents e610772 + 689942e commit dab053b
Show file tree
Hide file tree
Showing 6 changed files with 498 additions and 493 deletions.
10 changes: 10 additions & 0 deletions app/background/wallet/stats.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
const { states } = require("hsd/lib/covenants/namestate");

/** @param {import('hsd/lib/wallet/wallet')} wallet */
async function fromBids(wallet) {
const height = wallet.wdb.height;
const network = wallet.network;
Expand Down Expand Up @@ -30,6 +31,12 @@ async function fromBids(wallet) {
const ns = await wallet.getNameState(bid.nameHash);
const state = ns.state(height, network);

// Only consider bids from the latest auction (is local?)
const bidTx = await wallet.getTX(bid.prevout.hash);
if (bidTx.height < ns.height) {
continue;
}

// Full bid + blind is locked up in the bidding phase
if (state === states.BIDDING) {
biddingNum++;
Expand Down Expand Up @@ -87,6 +94,7 @@ async function fromBids(wallet) {
};
}

/** @param {import('hsd/lib/wallet/wallet')} wallet */
async function fromReveals(wallet) {
const height = wallet.wdb.height;
const network = wallet.network;
Expand Down Expand Up @@ -145,6 +153,7 @@ async function fromReveals(wallet) {
};
}

/** @param {import('hsd/lib/wallet/wallet')} wallet */
async function fromNames(wallet) {
const height = wallet.wdb.height;
const network = wallet.network;
Expand Down Expand Up @@ -236,6 +245,7 @@ async function fromNames(wallet) {
};
}

/** @param {import('hsd/lib/wallet/wallet')} wallet */
export async function getStats(wallet) {
const [statsFromBids, statsFromReveals, statsFromNames] = await Promise.all([
fromBids(wallet),
Expand Down
5 changes: 2 additions & 3 deletions app/components/Collapsible/collapsible.scss
Original file line number Diff line number Diff line change
Expand Up @@ -35,20 +35,19 @@

&__content {
opacity: 1;
// padding: 1rem;
position: relative;
max-height: 35rem;
height: auto;
transition: 0.5s ease-out;

&--hidden {
opacity: 0;
max-height: 0;
max-height: 0 !important;
overflow: hidden;
transition: 0.5s ease-out;
}

&--overflowY {
max-height: 35rem;
overflow-y: auto;
}
}
Expand Down
18 changes: 11 additions & 7 deletions app/components/Records/EditableRecord.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import React, { Component } from 'react';
import PropTypes from 'prop-types';
import deepEqual from 'deep-equal';
import { TableItem, TableRow } from '../Table';
import { DROPDOWN_TYPES } from '../../ducks/names';
import { deserializeRecord, serializeRecord, validate } from '../../utils/recordHelpers';
Expand All @@ -26,15 +27,18 @@ class EditableRecord extends Component {
};
}

componentDidUpdate() {
componentDidUpdate(prevProps) {
const {type} = this.props.record || {};
const currentTypeIndex = DROPDOWN_TYPES.findIndex(d => d.label === type);
this.setState({
isEditing: false,
value: serializeRecord(this.props.record),
errorMessage: '',
currentTypeIndex: Math.max(currentTypeIndex, 0),
});

if (!deepEqual(this.props.record, prevProps.record)) {
this.setState({
isEditing: false,
value: serializeRecord(this.props.record),
errorMessage: '',
currentTypeIndex: Math.max(currentTypeIndex, 0),
});
}
}

cancel = () => {
Expand Down
Loading

0 comments on commit dab053b

Please sign in to comment.