Skip to content

Commit

Permalink
Merge pull request #228 from RunOnFlux/dev
Browse files Browse the repository at this point in the history
v1.6.1
  • Loading branch information
TheTrunk authored Jul 25, 2024
2 parents 2ba1128 + 3009adb commit 3e28eab
Show file tree
Hide file tree
Showing 17 changed files with 613 additions and 623 deletions.
26 changes: 13 additions & 13 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "ssp-wallet",
"description": "Secure. Simple. Powerful.",
"private": true,
"version": "1.6.0",
"version": "1.6.1",
"type": "module",
"scripts": {
"dev": "vite",
Expand All @@ -21,7 +21,7 @@
"@runonflux/utxo-lib": "~1.0.0",
"@scure/bip32": "~1.4.0",
"@scure/bip39": "~1.3.0",
"antd": "~5.19.1",
"antd": "~5.19.3",
"assert": "~2.1.0",
"axios": "~1.7.2",
"bchaddrjs": "~0.5.2",
Expand All @@ -30,7 +30,7 @@
"crypto-browserify": "~3.12.0",
"currency-symbol-map": "~5.1.0",
"events": "~3.3.0",
"i18next": "~23.11.5",
"i18next": "~23.12.2",
"localforage": "~1.10.0",
"lru-cache": "~11.0.0",
"patch-package": "~8.0.0",
Expand All @@ -41,7 +41,7 @@
"react-dom": "~18.3.1",
"react-i18next": "~14.1.2",
"react-redux": "~9.1.2",
"react-router-dom": "~6.24.1",
"react-router-dom": "~6.25.1",
"react-secure-storage": "~1.3.2",
"socket.io-client": "~4.7.5",
"stream-browserify": "~3.0.0",
Expand All @@ -50,23 +50,23 @@
},
"devDependencies": {
"@types/bchaddrjs": "~0.4.3",
"@types/chrome": "~0.0.268",
"@types/node": "~20.14.10",
"@types/chrome": "~0.0.269",
"@types/node": "~20.14.12",
"@types/react": "~18.3.3",
"@types/react-dom": "~18.3.0",
"@types/react-redux": "~7.1.33",
"@types/react-router-dom": "~5.3.3",
"@typescript-eslint/eslint-plugin": "~7.16.0",
"@typescript-eslint/parser": "~7.16.0",
"@typescript-eslint/eslint-plugin": "~7.17.0",
"@typescript-eslint/parser": "~7.17.0",
"@vitejs/plugin-react-swc": "~3.7.0",
"eslint": "~8.57.0",
"eslint-plugin-react": "~7.34.3",
"eslint-plugin-react": "~7.35.0",
"eslint-plugin-react-hooks": "~4.6.2",
"eslint-plugin-react-refresh": "~0.4.8",
"prettier": "~3.3.2",
"eslint-plugin-react-refresh": "~0.4.9",
"prettier": "~3.3.3",
"tsx": "~4.16.2",
"typescript": "~5.5.3",
"vite": "~5.3.3"
"typescript": "~5.5.4",
"vite": "~5.3.4"
},
"engines": {
"node": ">=20"
Expand Down
2 changes: 1 addition & 1 deletion public/manifest.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "1.6.0",
"version": "1.6.1",
"manifest_version": 3,
"name": "SSP Wallet",
"short_name": "SSP",
Expand Down
88 changes: 50 additions & 38 deletions src/components/Navbar/Navbar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,11 @@ const balancesObject = {
unconfirmed: '0.00',
};

function Navbar(props: { refresh: () => void; hasRefresh: boolean }) {
function Navbar(props: {
refresh: () => void;
hasRefresh: boolean;
allowChainSwitch?: boolean;
}) {
const { t } = useTranslation(['home', 'common']);
const { activeChain } = useAppSelector((state) => state.sspState);
const { wallets, walletInUse, xpubKey, xpubWallet } = useAppSelector(
Expand Down Expand Up @@ -497,49 +501,53 @@ function Navbar(props: { refresh: () => void; hasRefresh: boolean }) {
</span>
</div>
{menu}
<Divider style={{ margin: '8px 0' }} />
<Button
type="text"
icon={<PlusOutlined />}
onClick={addWallet}
style={{ width: '100%', textAlign: 'left' }}
>
{t('home:navbar.generate_new_wallet')}
</Button>
{walletItems.length > 1 && (
<Popconfirm
title={t('home:navbar.remove_last_wallet')}
description={
<>{t('home:navbar.remove_last_wallet_desc')}</>
}
overlayStyle={{ maxWidth: 360, margin: 10 }}
okText={t('home:navbar.remove')}
cancelText={t('common:cancel')}
onConfirm={() => {
removeAddress();
}}
icon={
<QuestionCircleOutlined style={{ color: 'blue' }} />
}
>
{props.allowChainSwitch && (
<>
<Divider style={{ margin: '8px 0' }} />
<Button
type="text"
icon={<MinusOutlined />}
icon={<PlusOutlined />}
onClick={addWallet}
style={{ width: '100%', textAlign: 'left' }}
>
{t('home:navbar.remove_last_wallet')}
{t('home:navbar.generate_new_wallet')}
</Button>
</Popconfirm>
{walletItems.length > 1 && (
<Popconfirm
title={t('home:navbar.remove_last_wallet')}
description={
<>{t('home:navbar.remove_last_wallet_desc')}</>
}
overlayStyle={{ maxWidth: 360, margin: 10 }}
okText={t('home:navbar.remove')}
cancelText={t('common:cancel')}
onConfirm={() => {
removeAddress();
}}
icon={
<QuestionCircleOutlined style={{ color: 'blue' }} />
}
>
<Button
type="text"
icon={<MinusOutlined />}
style={{ width: '100%', textAlign: 'left' }}
>
{t('home:navbar.remove_last_wallet')}
</Button>
</Popconfirm>
)}
<Divider style={{ margin: '8px 0' }} />
<Button
type="text"
style={{ width: '100%', textAlign: 'left' }}
icon={<NodeIndexOutlined />}
onClick={() => selectChain()}
>
{t('home:navbar.switch_chain')}
</Button>
</>
)}
<Divider style={{ margin: '8px 0' }} />
<Button
type="text"
style={{ width: '100%', textAlign: 'left' }}
icon={<NodeIndexOutlined />}
onClick={() => selectChain()}
>
{t('home:navbar.switch_chain')}
</Button>
</>
)}
/>
Expand Down Expand Up @@ -588,4 +596,8 @@ function Navbar(props: { refresh: () => void; hasRefresh: boolean }) {
);
}

Navbar.defaultProps = {
allowChainSwitch: true,
};

export default Navbar;
12 changes: 8 additions & 4 deletions src/components/Settings/Settings.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* eslint-disable @typescript-eslint/no-misused-promises */
import { useState } from 'react';
import { useEffect, useState } from 'react';
import { Link } from 'react-router-dom';
import { Button, Modal, Input, Space, message, Select } from 'antd';
import { NoticeType } from 'antd/es/message/interface';
Expand All @@ -18,9 +18,6 @@ import { currency } from '../../types';
import { supportedFiatValues, getFiatSymbol } from '../../lib/currency.ts';
import { setFiatRates } from '../../store';

const backendsOriginalConfig = backendsOriginal();
const originalConfig = sspConfigOriginal();

interface sspConfigType {
relay?: string;
fiatCurrency?: keyof currency;
Expand All @@ -44,6 +41,13 @@ function Settings(props: {
const [messageApi, contextHolder] = message.useMessage();
const blockchainConfig = blockchains[activeChain];

const backendsOriginalConfig = backendsOriginal();
const originalConfig = sspConfigOriginal();

useEffect(() => {
setNodeConfig(NC);
}, [activeChain]);

const displayMessage = (type: NoticeType, content: string) => {
void messageApi.open({
type,
Expand Down
2 changes: 1 addition & 1 deletion src/pages/Send/Send.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -782,7 +782,7 @@ function Send() {
return (
<>
{contextHolder}
<Navbar refresh={refresh} hasRefresh={false} />
<Navbar refresh={refresh} hasRefresh={false} allowChainSwitch={false} />
<Divider />
<Form
name="sendForm"
Expand Down
2 changes: 1 addition & 1 deletion src/pages/SendEVM/SendEVM.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -864,7 +864,7 @@ function SendEVM() {
return (
<>
{contextHolder}
<Navbar refresh={refresh} hasRefresh={false} />
<Navbar refresh={refresh} hasRefresh={false} allowChainSwitch={false} />
<Divider />
<Form
name="sendForm"
Expand Down
115 changes: 48 additions & 67 deletions src/storage/backends.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,77 +24,58 @@ export function loadBackendsConfig() {
loadBackendsConfig();

// *** BACKENDS ***
const flux = {
node: 'explorer.runonflux.io',
};
const fluxTestnet = {
node: 'testnet.runonflux.io',
};
const rvn = {
node: 'blockbookravencoin.app.runonflux.io',
};
const ltc = {
node: 'blockbooklitecoin.app.runonflux.io',
};
const btc = {
node: 'blockbookbitcoin.app.runonflux.io',
};
const doge = {
node: 'blockbookdogecoin.app.runonflux.io',
};
const zec = {
node: 'blockbookzcash.app.runonflux.io',
};
const bch = {
node: 'blockbookbitcoincash.app.runonflux.io',
};
const btcTestnet = {
node: 'blockbookbitcointestnet.app.runonflux.io',
};
const btcSignet = {
node: 'blockbookbitcoinsignet.app.runonflux.io',
};
const sepolia = {
node: 'node.ethereum-sepolia.runonflux.io',
api: 'api.ethereum-sepolia.runonflux.io/api',
explorer: 'sepolia.etherscan.io'
};
const eth = {
node: 'node.ethereum-mainnet.runonflux.io',
api: 'api.ethereum-mainnet.runonflux.io/api',
explorer: 'etherscan.io'
const assetBackends: backends = {
flux: {
node: 'explorer.runonflux.io',
},
fluxTestnet: {
node: 'testnet.runonflux.io',
},
rvn: {
node: 'blockbookravencoin.app.runonflux.io',
},
ltc: {
node: 'blockbooklitecoin.app.runonflux.io',
},
btc: {
node: 'blockbookbitcoin.app.runonflux.io',
},
doge: {
node: 'blockbookdogecoin.app.runonflux.io',
},
zec: {
node: 'blockbookzcash.app.runonflux.io',
},
bch: {
node: 'blockbookbitcoincash.app.runonflux.io',
},
btcTestnet: {
node: 'blockbookbitcointestnet.app.runonflux.io',
},
btcSignet: {
node: 'blockbookbitcoinsignet.app.runonflux.io',
},
sepolia: {
node: 'node.ethereum-sepolia.runonflux.io',
api: 'api.ethereum-sepolia.runonflux.io/api',
explorer: 'sepolia.etherscan.io',
},
eth: {
node: 'node.ethereum-mainnet.runonflux.io',
api: 'api.ethereum-mainnet.runonflux.io/api',
explorer: 'etherscan.io',
},
};

export function backends() {
return {
flux: localForgeBackends?.flux || flux,
fluxTestnet: localForgeBackends?.fluxTestnet || fluxTestnet,
rvn: localForgeBackends?.rvn || rvn,
ltc: localForgeBackends?.ltc || ltc,
btc: localForgeBackends?.btc || btc,
doge: localForgeBackends?.doge || doge,
zec: localForgeBackends?.zec || zec,
bch: localForgeBackends?.bch || bch,
btcTestnet: localForgeBackends?.btcTestnet || btcTestnet,
btcSignet: localForgeBackends?.btcSignet || btcSignet,
sepolia: localForgeBackends?.sepolia || sepolia,
eth: localForgeBackends?.eth || eth,
};
const backendKeys = Object.keys(assetBackends);
const currentBackends: backends = backendKeys.reduce((acc, key) => {
acc[key] = localForgeBackends[key] || assetBackends[key];
return acc;
}, {} as backends);
return currentBackends;
}

export function backendsOriginal() {
return {
flux,
fluxTestnet,
rvn,
ltc,
btc,
doge,
zec,
bch,
btcTestnet,
btcSignet,
sepolia,
eth,
};
return assetBackends;
}
12 changes: 2 additions & 10 deletions src/store/chainSliceBase/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { createSlice, PayloadAction } from '@reduxjs/toolkit';
import { transaction, wallets, wallet } from '../../types';
import { transaction, wallet, chainState } from '../../types';

const initialWalletState: wallet = {
address: '',
Expand All @@ -10,15 +10,7 @@ const initialWalletState: wallet = {
transactions: [],
};

interface ChainState {
xpubWallet: string;
xpubKey: string;
wallets: wallets;
blockheight: number;
walletInUse: string;
}

const initialState: ChainState = {
const initialState: chainState = {
xpubWallet: '',
xpubKey: '',
wallets: {},
Expand Down
Loading

0 comments on commit 3e28eab

Please sign in to comment.