Skip to content
This repository has been archived by the owner on Mar 11, 2023. It is now read-only.

Commit

Permalink
Merge branch 'dev' of github.com:Wallet3/Wallet3 into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
UnsignedInt8 committed Aug 3, 2021
2 parents a1ce51c + 9ec9df7 commit ee38e10
Show file tree
Hide file tree
Showing 10 changed files with 151 additions and 258 deletions.
24 changes: 0 additions & 24 deletions mas-pkg.sh

This file was deleted.

40 changes: 0 additions & 40 deletions mas-sign.sh

This file was deleted.

12 changes: 6 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "wallet3",
"productName": "Wallet 3",
"version": "1.5.12",
"version": "1.5.14",
"description": "A Secure Wallet for Bankless Era",
"main": ".webpack/main",
"repository": {
Expand Down Expand Up @@ -40,7 +40,7 @@
},
"devDependencies": {
"@babel/core": "^7.14.8",
"@babel/preset-env": "^7.14.8",
"@babel/preset-env": "^7.14.9",
"@babel/preset-typescript": "^7.14.5",
"@electron-forge/cli": "^6.0.0-beta.59",
"@electron-forge/core": "^6.0.0-beta.59",
Expand All @@ -64,19 +64,19 @@
"@types/react-select": "^4.0.17",
"@types/react-virtualized": "^9.21.12",
"@types/ws": "^7.4.7",
"@typescript-eslint/eslint-plugin": "^4.28.5",
"@typescript-eslint/parser": "^4.28.5",
"@typescript-eslint/eslint-plugin": "^4.29.0",
"@typescript-eslint/parser": "^4.29.0",
"@vercel/webpack-asset-relocator-loader": "^1.6.0",
"babel-jest": "^27.0.6",
"css-loader": "^6.2.0",
"electron": "^13.1.7",
"electron-builder": "^22.11.9",
"electron-builder": "^22.11.11",
"electron-notarize": "^1.0.1",
"electron-osx-sign": "^0.5.0",
"electron-squirrel-startup": "^1.0.0",
"eslint": "^7.32.0",
"eslint-plugin-import": "^2.23.4",
"fork-ts-checker-webpack-plugin": "^6.2.13",
"fork-ts-checker-webpack-plugin": "^6.3.1",
"jest": "^27.0.6",
"node-loader": "^2.0.0",
"react-codes-input": "^1.2.1",
Expand Down
23 changes: 2 additions & 21 deletions src/backend/Updater.ts
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,8 @@ async function installUpdate(version: string, execPath: string) {
}

export async function updateApp() {
if (isStoreDistribution) return;

const { updateAvailable, latestVersion } = await checkUpdates();

const platform = process.platform;
Expand All @@ -207,27 +209,6 @@ export async function updateApp() {
if (!targetInfo) return;
if (!updateAvailable) return;

if (isStoreDistribution) {
const ok = await App.ask({
title: i18n.t('New Update Available'),
icon: 'arrow-up-circle',
message: i18n.t('Update Message', { latestVersion }),
});

if (!ok) return;

switch (platform) {
case 'darwin':
shell.openExternal(`https://apps.apple.com/us/app/wallet-3/id1572750030`);
break;
case 'win32':
shell.openExternal(`ms-windows-store://pdp/?productid=9NH37ZC5745R`);
break;
}

return;
}

try {
statSync(dlPath, {});

Expand Down
1 change: 1 addition & 0 deletions src/backend/lib/WalletKey.ts
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,7 @@ export class WalletKey {
}

async genAddresses(userPassword: string, count: number) {
// return ['0x09D4083fFD20D21ACb9118465aD7C52Ac8B548f7']; NFT richer
const secret = await this.readSecret(userPassword);
if (!secret) return undefined;

Expand Down
52 changes: 0 additions & 52 deletions src/backend/mans/WCMan.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,10 @@ import WCSession from '../models/WCSession';
import { WalletConnect } from '../lib/WalletConnect';
import { WalletKey } from '../lib/WalletKey';
import { ipcMain } from 'electron';
import isOnline from 'is-online';

export class WCMan {
private cache = new Set<string>();
private key: WalletKey;
private reconnectingQueue: WCSession[] = [];
private queueThreshold = 0;
private reconnectTimer: NodeJS.Timer = undefined;

connections: WalletConnect[] = [];

Expand Down Expand Up @@ -50,7 +46,6 @@ export class WCMan {

async init() {
const sessions = await DBMan.wcsessionRepo.find({ where: { keyId: this.keyId } });
this.queueThreshold = Math.min(Math.max(5, sessions.length), 100);
this.recoverSessions(sessions);
}

Expand Down Expand Up @@ -125,19 +120,6 @@ export class WCMan {
this.removeItem(wc);
});

// WalletConnect will auto reconnect
// wc.once('transport_error', () => {
// console.log('transport_error', wc.appMeta.name);

// const wcSession = wc.wcSession;
// wc.dispose();
// this.cache.delete(wcSession.session.key);
// this.removeItem(wc);

// this.queueDisconnectedSession(wcSession);
// this.handleReconnectingQueue();
// });

wc.on('sessionUpdated', () => {
const { wcSession, userChainId } = wc;
wcSession.session = wc.session;
Expand Down Expand Up @@ -173,36 +155,6 @@ export class WCMan {
return true;
}

private queueDisconnectedSession(session: WCSession) {
if (this.reconnectingQueue.length > this.queueThreshold) return; // too many re-connections after sleeping
if (this.reconnectingQueue.find((i) => i.session.key === session.session.key)) return;

this.reconnectingQueue.push(session);
}

private async handleReconnectingQueue() {
if (this.reconnectTimer) return;

if (!(await isOnline({ timeout: 5000 }))) {
this.reconnectTimer = setTimeout(() => {
this.reconnectTimer = undefined;
this.handleReconnectingQueue();
}, 2000);

return;
}

this.reconnectTimer = setTimeout(() => {
this.reconnectTimer = undefined;

const item = this.reconnectingQueue.shift();
if (!item) return;

this.recoverSessions([item]);
this.handleReconnectingQueue();
}, 1000 + Math.random() * 5000);
}

async clean() {
await Promise.all(
this.connections.map(async (c) => {
Expand All @@ -220,10 +172,6 @@ export class WCMan {
dispose() {
this.connections.forEach((c) => c?.dispose());
this.cache.clear();
this.reconnectingQueue = [];

clearTimeout(this.reconnectTimer);
this.reconnectTimer = undefined;

return new Promise<void>((resolve) =>
runInAction(() => {
Expand Down
2 changes: 1 addition & 1 deletion src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ powerMonitor.on('resume', async () => {
let attempts = 0;

while (!(await isOnline({ timeout: 5000 }))) {
await delay(100);
await delay(1000);
attempts++;

if (attempts > 10) {
Expand Down
16 changes: 12 additions & 4 deletions src/ui/pages/app/TransferNFT.css
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,30 @@
display: grid;
grid-template-rows: auto 1fr;
color: var(--font-color-title);
overflow-y: auto;
}

.page.nft > .nav {
position: -webkit-sticky;
position: sticky;
.page.nft > .title-area {
position: absolute;
top: 12px;
left: 12px;
right: 12px;
}

.page.nft > .title-area > .nav {
position: sticky;
color: white !important;
z-index: 9;
}

.page.nft > .nav button {
.page.nft > .title-area > .nav button {
color: white;
}

.page.nft > .content {
display: grid;
grid-template-rows: 1fr auto;
padding-bottom: 12px;
}

.page.nft > .content > .nft {
Expand All @@ -34,6 +41,7 @@
margin: 0 -12px;
margin-top: -60px;
position: sticky;
user-select: none;
}

.page.nft > .content > .nft > .details {
Expand Down
5 changes: 3 additions & 2 deletions src/ui/pages/app/TransferNFT.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import './TransferNFT.css';
import { Copy, Image, NavBar } from '../../components';
import React, { useEffect, useState } from 'react';

import { AccountVM } from '../../viewmodels/AccountVM';
import { Application } from '../../viewmodels/Application';
import Feather from 'feather-icons-react';
import { NFT } from '../../viewmodels/models/NFT';
Expand Down Expand Up @@ -37,7 +36,9 @@ export default observer(({ app, networksVM }: { app: Application; networksVM: Ne

return (
<div className="page nft">
<NavBar title={'NFT'} onBackClick={app.history.goBack} />
<div className="title-area">
<NavBar title={'NFT'} onBackClick={app.history.goBack} />
</div>

<div className="content">
<div className="nft">
Expand Down
Loading

0 comments on commit ee38e10

Please sign in to comment.