Skip to content

Commit

Permalink
Merge pull request #74 from haven-protocol-org/develop
Browse files Browse the repository at this point in the history
Merge develop (Audit)
  • Loading branch information
kleinroy authored Dec 2, 2024
2 parents 5090e07 + 8126f4b commit 66469cf
Show file tree
Hide file tree
Showing 41 changed files with 1,002 additions and 73 deletions.
30 changes: 15 additions & 15 deletions client/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions client/package.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
{
"name": "haven_web_wallet",
"version": "4.1.0",
"version": "4.2.0",
"private": true,
"dependencies": {
"assert": "^2.0.0",
"big-integer": "^1.6.51",
"buffer": "^6.0.3",
"crypto-browserify": "^3.12.0",
"haven-wallet-core": "^4.1.1",
"haven-wallet-core": "^4.2.0",
"history": "^5.3.0",
"https-browserify": "^1.0.0",
"nth-check": "^2.1.1",
Expand Down
3 changes: 0 additions & 3 deletions client/public/HavenWebWorker4.1.0.js

This file was deleted.

1 change: 0 additions & 1 deletion client/public/HavenWebWorker4.1.0.js.map

This file was deleted.

3 changes: 3 additions & 0 deletions client/public/HavenWebWorker4.2.0.js

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions client/public/HavenWebWorker4.2.0.js.map

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Binary file not shown.
22 changes: 22 additions & 0 deletions client/src/constants/env.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,28 @@ export const getPort = () => {
return window.location.port;
};

export const getForkHeights = () => {
if (isMainnet()) {
if (isDevMode()) {
return {
HF_VERSION_SUPPLY_AUDIT: 1732000,
HF_VERSION_SUPPLY_AUDIT_END: 1732100,
HF_VERSION_VBS_DISABLING: 1732200
}
}
return {
HF_VERSION_SUPPLY_AUDIT: 1752270,
HF_VERSION_SUPPLY_AUDIT_END: 1783950,
HF_VERSION_VBS_DISABLING: 1788990
}
}
return {
HF_VERSION_SUPPLY_AUDIT: 1,
HF_VERSION_SUPPLY_AUDIT_END: 2,
HF_VERSION_VBS_DISABLING: 3
}
}

let apiUrl;

if (isWeb()) {
Expand Down
8 changes: 8 additions & 0 deletions client/src/constants/notificationList.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ export const WALLET_NEEDS_CONNECTION = "wallet_needs_connection";
export const WALLET_IS_CONNECTING = "wallet_is_connecting";
export const WALLET_CONNECT_SUCCEED = "wallet_connect_succeed";

export const AUDIT_SUCCEED_MESSAGE = "audit_succeed_message";

export const notificationList = [
{
key: TRANSFER_SUCCEED_MESSAGE,
Expand Down Expand Up @@ -357,4 +359,10 @@ export const notificationList = [
type: NotificationType.ERROR,
description: WALLET_NEEDS_CONNECTION,
},
{
key: AUDIT_SUCCEED_MESSAGE,
code: 0,
message: "Your audit was successfully submitted!",
type: NotificationType.SUCCESS,
},
];
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import { LoginOnboardingModal } from "platforms/desktop/components/modals/loginO
import { QRCodeModal } from "../modals/showQRCode";
import { ManageAddressModal } from "../modals/manageAddressModal";
import { RescanBCMModal } from "../modals/rescanBCModal";
import { AuditModal } from "../modals/confirmAuditModal";

class ModalContainer extends React.Component<any, any> {
render() {
Expand All @@ -29,6 +30,8 @@ class ModalContainer extends React.Component<any, any> {
// return <LoginOnboardingModal />;
case MODAL_TYPE.RescanBC:
return <RescanBCMModal />;
case MODAL_TYPE.ConfirmAudit:
return <AuditModal />;
}
return null;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
import * as React from "react";
import { Modal } from "shared/components/modal";
import { HavenAppState } from "platforms/desktop/reducers/index.js";
import { connect } from "react-redux";
import { hideModal } from "shared/actions/modal";
import { AuditProcessInfo } from "shared/reducers/auditProcess";
import { confirmAudit, resetAuditProcess } from "shared/actions/audit";
import Confirm from "shared/components/confirm";
import { Container, Information, Url } from "shared/components/_transactions/exchange/styles";

interface ConfirmTxModalProps {
audit: AuditProcessInfo;
confirmAudit: (metaList: Array<string>) => void;
resetAuditProcess: () => void;
hideModal: () => void;
}

class AuditM extends React.Component<any, any> {
state = {
checked: false,
loading: false,
};

onAgreementChange = () => {
this.setState({
checked: !this.state.checked,
});
};

onCancel() {
this.props.hideModal();
this.props.resetAuditProcess();
}

onConfirm() {
const { metaList } = this.props.audit;

this.setState({
loading: true,
});
setTimeout(() => {
this.props.confirmAudit(metaList);
}, 30000);
}

render() {
//const { isLoading } = this.state;
return (
<Modal
title="Audit Confirmation"
description="Please read and agree to the terms below before proceeding"
leftButton="Cancel"
rightButton="Confirm"
disabledLeft={false}
disabledRight={!this.state.checked}
isLoading={this.state.loading}
onCancel={() => this.onCancel()}
onConfirm={() => this.onConfirm()}
>
<Information>
<strong>Note:</strong> Your entire balance may be locked and unusable for the entirety of the ~20m unlock priority time. However, this
amount will be unlocked and usable once the <strong>{this.props.audit.metaList.length} audit transactions</strong> is/are complete.
To understand why this happens and how it might impact your experience,
please{" "}
<strong>
<Url
target="_blank"
href="https://havenprotocol.org/knowledge/haven-transactions/"
>
click here.
</Url>
</strong>
</Information>
<Container>
<Confirm
description="I accept the ~20m Unlock Time, Details, Terms & Fees."
checked={this.state.checked}
onChange={this.onAgreementChange}
label=""
/>
</Container>
</Modal>
);
}
}

const mapStateToProps = (state: HavenAppState) => ({
audit: state.auditProcess
});

export const AuditModal = connect(mapStateToProps, {
confirmAudit,
hideModal,
resetAuditProcess
})(AuditM);
6 changes: 5 additions & 1 deletion client/src/platforms/desktop/reducers/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ import modal from "shared/reducers/modal";
import { WebAppState } from "platforms/web/reducers";
import { storedWallets } from "./storedWallets";
import { circulatingSupply } from "shared/reducers/circulatingSupply";
import auditStatus from "shared/reducers/auditStatus";
import { auditProcess } from "shared/reducers/auditProcess";

const appReducer = combineReducers({
theme,
Expand All @@ -42,7 +44,9 @@ const appReducer = combineReducers({
modal,
connectedNode,
nodeList,
circulatingSupply
circulatingSupply,
auditStatus,
auditProcess
});

const rootReducer = (state: any, action: AnyAction) => {
Expand Down
6 changes: 5 additions & 1 deletion client/src/platforms/web/reducers/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ import modal from "shared/reducers/modal";
import { STOP_WALLET_SESSION } from "shared/actions/types";
import { connectedNode } from "platforms/desktop/reducers/selectedNode"
import { circulatingSupply } from "shared/reducers/circulatingSupply";
import auditStatus from "shared/reducers/auditStatus";
import { auditProcess } from "shared/reducers/auditProcess";

const appReducer = combineReducers({
theme,
Expand All @@ -35,7 +37,9 @@ const appReducer = combineReducers({
walletCreation,
modal,
connectedNode,
circulatingSupply
circulatingSupply,
auditStatus,
auditProcess
});

const rootReducer = (state: any, action: AnyAction) => {
Expand Down
2 changes: 2 additions & 0 deletions client/src/shared/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import Loader from "shared/components/loader";
import { AssetsDesktop } from "platforms/desktop/pages/_wallet/assets";
import { HavenDetailWithParams } from "platforms/desktop/pages/_wallet/details";
import { ExchangePage } from "shared/pages/_wallet/exchange";
import { AuditPage } from "shared/pages/_wallet/audit";
import { HavenTransfer } from "platforms/desktop/pages/_wallet/transfer";
import { SettingsDesktop } from "platforms/desktop/pages/_wallet/settings";
import { SettingsWeb } from "platforms/web/pages/_wallet/settings";
Expand Down Expand Up @@ -43,6 +44,7 @@ class App extends Component {
<Route path="transfer" element={<HavenTransfer />}/>
<Route path="settings" element={isDesktop() ? <SettingsDesktop /> : <SettingsWeb />}/>
<Route path="convert" element={<ExchangePage />} />
<Route path="audit" element={<AuditPage />} />
</Route>
<Route path="*" element={<Navigate to="/" replace />} />
</Routes>
Expand Down
Loading

0 comments on commit 66469cf

Please sign in to comment.