Skip to content

Commit

Permalink
Merge pull request #654 from rithvikvibhu/hsd-update-6
Browse files Browse the repository at this point in the history
Update hsd and add soft fork changes
  • Loading branch information
rithvikvibhu committed Feb 3, 2024
2 parents 429e180 + 87d476f commit 227a690
Show file tree
Hide file tree
Showing 10 changed files with 160 additions and 80 deletions.
3 changes: 2 additions & 1 deletion app/background/node/service.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import fs from 'fs';
import crypto from 'crypto';
import EventEmitter from 'events';
import throttle from 'lodash.throttle';
import { NodeClient } from 'hs-client';
import { NodeClient } from 'hsd/lib/client';
import { BigNumber } from 'bignumber.js';
import { ConnectionTypes, getConnection, getCustomRPC } from '../connections/service';
import FullNode from 'hsd/lib/node/fullnode';
Expand Down Expand Up @@ -237,6 +237,7 @@ export class NodeService extends EventEmitter {
listen: this.networkName === 'regtest', // improves remote rpc dev/testing
chainMigrate: 3,
walletMigrate: 2,
walletIcannlockup: true,
maxOutbound: 4,
compactTreeOnInit: true,
});
Expand Down
2 changes: 1 addition & 1 deletion app/background/wallet/service.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { WalletClient } from 'hs-client';
import { WalletClient } from 'hsd/lib/client';
import BigNumber from 'bignumber.js';
import crypto from 'crypto';
const secp256k1 = require('bcrypto/lib/secp256k1');
Expand Down
26 changes: 23 additions & 3 deletions app/pages/Auction/BidActionPanel/Reserved.js
Original file line number Diff line number Diff line change
@@ -1,26 +1,46 @@
import React, { Component } from 'react';
import PropTypes from 'prop-types';
import { shell } from 'electron';
import {
AuctionPanel,
} from '../../../components/AuctionPanel';
import {I18nContext} from "../../../utils/i18n";
import { I18nContext } from "../../../utils/i18n";

export default class Reserved extends Component {
static propTypes = {
domain: PropTypes.object.isRequired,
name: PropTypes.string.isRequired,
locked: PropTypes.bool.isRequired,
};

static contextType = I18nContext;

render() {
const { t } = this.context;
const { locked } = this.props;

return (
<AuctionPanel className="domains__action-panel__reserved">
<div className="domains__action-panel__reserved-text">
{this.context.t('reservedText')}
{locked ? t('lockedText') : t('reservedText')}
</div>
<div className="domains__action-panel__reserved-timestamp">
{this.context.t('reservedTimestamp')}
{locked ?
<>
<span>
{t('lockedDescription')}
</span>
<p>
<a
className="anchor"
onClick={() => shell.openExternal(t('lockedLearnMoreURL'))}
>
{t('learnMore')}
</a>
</p>
</>
: t('reservedTimestamp')
}
</div>
</AuctionPanel>
);
Expand Down
7 changes: 4 additions & 3 deletions app/pages/Auction/BidActionPanel/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import PropTypes from 'prop-types';
import { withRouter } from 'react-router';
import { connect } from 'react-redux';
import c from 'classnames';
import { isAvailable, isBidding, isClosed, isOpening, isReserved, isReveal } from '../../../utils/nameHelpers';
import { isAvailable, isBidding, isClosed, isOpening, isReserved, isLockedUp, isReveal } from '../../../utils/nameHelpers';
import * as watchingActions from '../../../ducks/watching';
import OpenBid from './OpenBid';
import BidNow from './BidNow';
Expand Down Expand Up @@ -81,9 +81,10 @@ class BidActionPanel extends Component {
renderActionPanel() {
const {domain} = this.props;
const name = this.props.match.params.name;
const locked = isLockedUp(domain);

if (isReserved(domain)) {
return <Reserved domain={domain} name={name} />;
if (isReserved(domain) || locked) {
return <Reserved domain={domain} name={name} locked={locked} />;
}

if (this.isOwned()) {
Expand Down
1 change: 1 addition & 0 deletions app/pages/Auction/domains.scss
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@
font-size: 1.25rem;
font-weight: 600;
padding: .4rem 0 .2rem;
text-transform: capitalize;
}

&__description {
Expand Down
7 changes: 5 additions & 2 deletions app/pages/Auction/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import {
isComingSoon,
isOpening,
isReserved,
isLockedUp,
isReveal,
} from '../../utils/nameHelpers';
import BidActionPanel from './BidActionPanel';
Expand Down Expand Up @@ -138,7 +139,7 @@ export default class Auction extends Component {
renderAuctionRight = () => {
const {domain} = this.props;

if (isReserved(domain)) {
if (isReserved(domain) || isLockedUp(domain)) {
return <BidActionPanel domain={domain} />;
}

Expand Down Expand Up @@ -273,7 +274,7 @@ export default class Auction extends Component {
return (
<div className={className}>
<div className={`${className}__label`}>{title}:</div>
<div className={`${className}__status`}>{content}</div>
<div className={`${className}__status`}>{content?.toLowerCase?.()}</div>
<div className={`${className}__description`}>{description}</div>
</div>
);
Expand Down Expand Up @@ -313,6 +314,8 @@ export default class Auction extends Component {
{t('reservedCTAText')}
</button>
);
} else if (isLockedUp(domain)) {
status = t('locked');
} else if (isOpening(domain)) {
status = t('opening');
description = t('biddingSoon');
Expand Down
22 changes: 21 additions & 1 deletion app/utils/nameHelpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export const isAvailable = name => {
return false;
}

if (start.reserved) {
if (start.reserved || start.locked) {
return false;
}

Expand Down Expand Up @@ -61,6 +61,26 @@ export const isReserved = name => {
return !!start.reserved;
};

export const isLockedUp = name => {
const {start} = name || {};
const {info} = name || {};

// Maybe already claimed
if (isClosed(name))
return false;

// Not available if start is undefined
if (!start) {
return false;
}

if (info) {
return false;
}

return !!start.locked;
}

export const isOpening = name => checkState(name, states.OPENING);
export const isBidding = name => checkState(name, states.BIDDING);
export const isReveal = name => checkState(name, states.REVEAL);
Expand Down
3 changes: 3 additions & 0 deletions locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,9 @@
"loadingBalance": "Loading balance...",
"loadingNDomains": "Loading %s domains...",
"locked": "LOCKED",
"lockedDescription": "The Handshake network activated a soft fork in 2023 that locked a subset of the reserved names to remain locked up (unavailable for auction) till 2028.",
"lockedLearnMoreURL": "https://heytx.substack.com/p/the-happening-event-for-handshake",
"lockedText": "Locked by the ICANN Soft Fork",
"locktime": "Locktime",
"lockup": "Lockup",
"logDownloadSuccess": "Log file saved to %s.",
Expand Down
Loading

0 comments on commit 227a690

Please sign in to comment.