Skip to content

Commit

Permalink
Merge pull request #835 from crypto-com/dev
Browse files Browse the repository at this point in the history
Internal Release v0.5.6
  • Loading branch information
crypto-matto authored Nov 23, 2021
2 parents 588771c + 88ce9cc commit 019d542
Show file tree
Hide file tree
Showing 20 changed files with 338 additions and 131 deletions.
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,16 @@ All notable changes to this project will be documented in this file.

*Released*

## [v0.5.6] - 2021-11-23

### Additions
- Align on Chain namings
- CRC20 data support

### Bug fixes
- Added missing bridge history records for custom destination addresses
- Fixed validator list auto-filling in redelegate form

## [v0.5.5] - 2021-11-17

### Additions
Expand Down
9 changes: 5 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "chain-desktop-wallet",
"version": "0.5.5",
"version": "0.5.6",
"description": "Crypto.com Chain Desktop Wallet App",
"repository": "github:crypto-com/chain-desktop-wallet",
"author": "Crypto.org <[email protected]>",
Expand Down Expand Up @@ -73,7 +73,7 @@
"zxcvbn": "4.4.2"
},
"scripts": {
"run-audit": "yarn audit-ci --high -a 1002475 1002627 1002477 1002522 1002590",
"run-audit": "yarn audit-ci --high -a 1002475 1002627 1002477 1002522 1002590 1005059",
"start": "node scripts/start.js",
"build": "cross-env NODE_OPTIONS=--max_old_space_size=8192 && yarn clean-builds && node scripts/build.js",
"test": "node scripts/test.js --watchAll=false",
Expand Down Expand Up @@ -256,7 +256,7 @@
"terser-webpack-plugin": "4.2.3",
"wait-on": "5.2.1",
"webpack": "4.44.2",
"webpack-dev-server": "3.11.0",
"webpack-dev-server": "3.11.2",
"webpack-manifest-plugin": "2.2.0",
"workbox-webpack-plugin": "5.1.4"
},
Expand Down Expand Up @@ -329,6 +329,7 @@
"css-what": "5.0.1",
"trim-newlines": "3.0.1",
"normalize-url": "5.3.1",
"tar": "6.1.9"
"tar": "6.1.9",
"glob-parent": "5.1.2"
}
}
3 changes: 2 additions & 1 deletion src/components/AddressBookModal/AddAddressModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import { Session } from '../../models/Session';
import { AddressBookService } from '../../service/AddressBookService';
import { TransactionUtils } from '../../utils/TransactionUtils';
import { walletAllAssetsState } from '../../recoil/atom';
import { getChainName } from '../../utils/utils';

const { Option } = Select;

Expand Down Expand Up @@ -186,7 +187,7 @@ const AddAddressModal = (props: IAddAddressModalProps) => {
{SupportedNetworks.map(network => {
return (
<Option key={network.label} value={network.label}>
{network.label}
{getChainName(network.label, currentSession.wallet.config)}
</Option>
);
})}
Expand Down
16 changes: 4 additions & 12 deletions src/config/StaticAssets.ts
Original file line number Diff line number Diff line change
@@ -1,22 +1,14 @@
// Every created wallet get initialized with a new CRO asset
import { CroNetwork } from '@crypto-org-chain/chain-jslib/lib/dist/core/cro';
import { getRandomId } from '../crypto/RandomGen';
import { AssetCreationType, UserAssetConfig, UserAssetType } from '../models/UserAsset';
import { Network, WalletConfig } from './StaticConfig';
import { WalletConfig, SupportedChainName } from './StaticConfig';
import { checkIfTestnet } from '../utils/utils';
import iconCronosSvg from '../assets/icon-cronos-blue.svg';
import iconCroSvg from '../assets/icon-cro.svg';

// This will be used later for asset recreation/migration
export const STATIC_ASSET_COUNT = 2;

const checkIfTestnet = (network: Network) => {
return (
[CroNetwork.TestnetCroeseid3, CroNetwork.TestnetCroeseid4, CroNetwork.Testnet].includes(
network,
) || network.defaultNodeUrl.includes('testnet')
);
};

// Every created wallet get initialized with a new CRO asset
export const CRO_ASSET = (walletConfig: WalletConfig) => {
const { network } = walletConfig;
Expand All @@ -42,7 +34,7 @@ export const CRO_ASSET = (walletConfig: WalletConfig) => {
// 'https://s3-ap-southeast-1.amazonaws.com/monaco-cointrack-production/uploads/coin/colorful_logo/5c1248c15568a4017c20aa87/cro.png',
iconCroSvg,
identifier: getRandomId(),
name: 'Crypto.org Chain',
name: SupportedChainName.CRYPTO_ORG,
symbol: assetSymbol,
mainnetSymbol: 'CRO', // This is to be used solely for markets data since testnet market prices is always non existent
stakedBalance: '0',
Expand Down Expand Up @@ -94,7 +86,7 @@ export const CRONOS_ASSET = (walletConfig: WalletConfig) => {
// 'https://firebasestorage.googleapis.com/v0/b/chain-desktop-wallet.appspot.com/o/cronos_logo.png?alt=media&token=781c48a3-e89e-4dd4-87d3-d1a1b8e2e456',
iconCronosSvg,
identifier: getRandomId(),
name: 'Cronos Chain',
name: SupportedChainName.CRONOS,
symbol: isTestnet ? 'TCRO' : 'CRO',
mainnetSymbol: 'CRO', // This is to be used solely for markets data since testnet market prices is always non existent
stakedBalance: '0',
Expand Down
9 changes: 7 additions & 2 deletions src/config/StaticConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -158,16 +158,21 @@ SUPPORTED_CURRENCY.set('CZK', { value: 'CZK', label: 'CZK - Kč', symbol: 'Kč'
SUPPORTED_CURRENCY.set('BRL', { value: 'BRL', label: 'BRL - R$', symbol: 'R$' });
SUPPORTED_CURRENCY.set('TRY', { value: 'TRY', label: 'TRY - ₺', symbol: '₺' });

export enum SupportedChainName {
CRYPTO_ORG = 'Crypto.org Chain',
CRONOS = 'Cronos Chain',
}

export interface SupportedBridge {
value: string;
label: string;
}

export const SUPPORTED_BRIDGE = new Map<string, SupportedBridge>();
SUPPORTED_BRIDGE.set('CRONOS', { value: 'CRONOS', label: 'Cronos Chain' });
SUPPORTED_BRIDGE.set('CRONOS', { value: 'CRONOS', label: SupportedChainName.CRONOS });
SUPPORTED_BRIDGE.set('CRYPTO_ORG', {
value: 'CRYPTO_ORG',
label: 'Crypto.org Chain',
label: SupportedChainName.CRYPTO_ORG,
});

export const SUPPORTED_BRIDGES_ASSETS = ['CRO'];
Expand Down
5 changes: 3 additions & 2 deletions src/models/AddressBook.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { UserAssetType } from './UserAsset';
import { SupportedChainName } from '../config/StaticConfig';

export interface AddressBookContact {
id: string;
Expand All @@ -24,11 +25,11 @@ interface AddressBookNetwork {

const SupportedNetworks: AddressBookNetwork[] = [
{
label: 'Cronos Chain',
label: SupportedChainName.CRONOS,
networkType: UserAssetType.EVM,
},
{
label: 'Crypto.org Chain',
label: SupportedChainName.CRYPTO_ORG,
networkType: UserAssetType.TENDERMINT,
},
];
Expand Down
6 changes: 3 additions & 3 deletions src/pages/assets/assets.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import { AnalyticsService } from '../../service/analytics/AnalyticsService';
import ReceiveDetail from './components/ReceiveDetail';
import FormSend from './components/FormSend';
import { walletService } from '../../service/WalletService';
import { middleEllipsis } from '../../utils/utils';
import { getChainName, middleEllipsis } from '../../utils/utils';
import {
TransactionDirection,
TransactionStatus,
Expand Down Expand Up @@ -192,7 +192,7 @@ const AssetsPage = () => {
style={{ border: 'none', padding: '5px 14px', marginLeft: '10px' }}
color="processing"
>
{name}
{getChainName(name, session.wallet.config)}
</Tag>
);
},
Expand Down Expand Up @@ -397,7 +397,7 @@ const AssetsPage = () => {
style={{ border: 'none', padding: '5px 14px', marginLeft: '10px' }}
color="processing"
>
{currentAsset?.name}
{getChainName(currentAsset?.name, session.wallet.config)}
</Tag>
</div>
<div className="value">
Expand Down
22 changes: 15 additions & 7 deletions src/pages/bridge/bridge.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ import { walletService } from '../../service/WalletService';
import { UserAsset } from '../../models/UserAsset';
import { BroadCastResult } from '../../models/Transaction';
import { renderExplorerUrl } from '../../models/Explorer';
import { getAssetBySymbolAndChain, middleEllipsis } from '../../utils/utils';
import { getAssetBySymbolAndChain, getChainName, middleEllipsis } from '../../utils/utils';
import { TransactionUtils } from '../../utils/TransactionUtils';
import {
adjustedTransactionAmount,
Expand Down Expand Up @@ -318,8 +318,8 @@ const CronosBridge = props => {
<>
<div>
<span>
{t('bridge.form.from')} {bridgeFromObj?.label} {t('bridge.form.to')}{' '}
{bridgeToObj?.label}
{t('bridge.form.from')} {getChainName(bridgeFromObj?.label, session.wallet.config)}{' '}
{t('bridge.form.to')} {getChainName(bridgeToObj?.label, session.wallet.config)}
</span>
</div>
{session.wallet.walletType === LEDGER_WALLET_TYPE ? (
Expand Down Expand Up @@ -607,7 +607,9 @@ const CronosBridge = props => {
</Sider>
<Content>
<div>{t('bridge.form.from')}</div>
<div style={{ fontWeight: 'bold' }}>{bridgeFromObj?.label}</div>
<div style={{ fontWeight: 'bold' }}>
{getChainName(bridgeFromObj?.label, session.wallet.config)}
</div>
</Content>
</Layout>
<ArrowRightOutlined style={{ fontSize: '24px', width: '50px' }} />
Expand All @@ -617,7 +619,9 @@ const CronosBridge = props => {
</Sider>
<Content>
<div>{t('bridge.form.to')}</div>
<div style={{ fontWeight: 'bold' }}>{bridgeToObj?.label}</div>
<div style={{ fontWeight: 'bold' }}>
{getChainName(bridgeToObj?.label, session.wallet.config)}
</div>
</Content>
</Layout>
</div>
Expand Down Expand Up @@ -811,7 +815,9 @@ const CronosBridge = props => {
{bridgeIcon(bridgeFromObj?.value)}
</Sider>
<Content>
<div style={{ fontWeight: 'bold' }}>{bridgeFromObj?.label}</div>
<div style={{ fontWeight: 'bold' }}>
{getChainName(bridgeFromObj?.label, session.wallet.config)}
</div>
</Content>
</Layout>
<ArrowRightOutlined style={{ fontSize: '24px', width: '50px' }} />
Expand All @@ -820,7 +826,9 @@ const CronosBridge = props => {
{bridgeIcon(bridgeToObj?.value)}
</Sider>
<Content>
<div style={{ fontWeight: 'bold' }}>{bridgeToObj?.label}</div>
<div style={{ fontWeight: 'bold' }}>
{getChainName(bridgeToObj?.label, session.wallet.config)}
</div>
</Content>
</Layout>
</div>
Expand Down
11 changes: 7 additions & 4 deletions src/pages/bridge/components/BridgeTransactionHistory.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@ import {
bech32ToEVMAddress,
middleEllipsis,
getCronosAsset,
getCryptoOrgAsset,
getAssetBySymbolAndChain,
getChainName,
} from '../../../utils/utils';

import { walletService } from '../../../service/WalletService';
Expand All @@ -31,6 +33,7 @@ const BridgeTransactionHistory = () => {

// eslint-disable-next-line
const cronosAsset = getCronosAsset(walletAllAssets);
const cryptoOrgAsset = getCryptoOrgAsset(walletAllAssets);

const bridgeService = new BridgeService(walletService.storageService);

Expand Down Expand Up @@ -173,7 +176,7 @@ const BridgeTransactionHistory = () => {
</>
}
>
({source.chain.replace('-', ' ')})
({getChainName(source.chain.replace('-', ' '), session.wallet.config)})
</Tooltip>
</>
);
Expand Down Expand Up @@ -232,10 +235,10 @@ const BridgeTransactionHistory = () => {
</>
}
>
({destination.chain.replace('-', ' ')})
({getChainName(destination.chain.replace('-', ' '), session.wallet.config)})
</Tooltip>
) : (
<>({destination.chain.replace('-', ' ')})</>
<>({getChainName(destination.chain.replace('-', ' '), session.wallet.config)})</>
)}
</>
);
Expand Down Expand Up @@ -271,7 +274,7 @@ const BridgeTransactionHistory = () => {
useEffect(() => {
const fetchBridgeHistory = async () => {
if (cronosAsset) {
await bridgeService.fetchAndSaveBridgeTxs(cronosAsset?.address!);
await bridgeService.fetchAndSaveBridgeTxs(cronosAsset?.address!, cryptoOrgAsset?.address!);
}
const transactionHistory = await bridgeService.retrieveCurrentWalletBridgeTransactions();
const processedHistory = convertBridgeTransfers(transactionHistory);
Expand Down
11 changes: 8 additions & 3 deletions src/pages/bridge/components/CronosBridgeForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,12 @@ import { useTranslation } from 'react-i18next';
import { AddressType } from '@crypto-org-chain/chain-jslib/lib/dist/utils/address';
import { sessionState, walletAllAssetsState } from '../../../recoil/atom';
import { scaledBalance, UserAsset, UserAssetType } from '../../../models/UserAsset';
import { middleEllipsis, getCryptoOrgAsset, getCronosAsset } from '../../../utils/utils';
import {
middleEllipsis,
getCryptoOrgAsset,
getCronosAsset,
getChainName,
} from '../../../utils/utils';
import { fromScientificNotation, getCurrentMinAssetAmount } from '../../../utils/NumberUtils';
import {
SUPPORTED_BRIDGE,
Expand Down Expand Up @@ -374,7 +379,7 @@ const CronosBridgeForm = props => {
return (
<Option value={bridge.value} key={bridge.value}>
{bridgeIcon(bridge.value)}
{`${bridge.label}`}
{`${getChainName(bridge.label, session.wallet.config)}`}
</Option>
);
})}
Expand Down Expand Up @@ -454,7 +459,7 @@ const CronosBridgeForm = props => {
return (
<Option value={bridge.value} key={bridge.value}>
{bridgeIcon(bridge.value)}
{`${bridge.label}`}
{`${getChainName(bridge.label, session.wallet.config)}`}
</Option>
);
})}
Expand Down
10 changes: 8 additions & 2 deletions src/pages/home/home.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import {
} from '../../recoil/atom';
import { NOT_KNOWN_YET_VALUE, SUPPORTED_CURRENCY, WalletConfig } from '../../config/StaticConfig';
import { getUIDynamicAmount } from '../../utils/NumberUtils';
import { middleEllipsis, isJson, ellipsis } from '../../utils/utils';
import { middleEllipsis, isJson, ellipsis, getChainName } from '../../utils/utils';
import {
scaledAmount,
scaledStakingBalance,
Expand Down Expand Up @@ -117,12 +117,13 @@ const HomePage = () => {
sorter: (a, b) => a.name.localeCompare(b.name),
render: record => {
const { name } = record;

return (
<Tag
style={{ border: 'none', padding: '5px 14px', marginLeft: '10px' }}
color="processing"
>
{name}
{getChainName(name, currentSession.wallet.config)}
</Tag>
);
},
Expand Down Expand Up @@ -478,6 +479,11 @@ const HomePage = () => {
}, // click row
};
}}
locale={{
triggerDesc: t('general.table.triggerDesc'),
triggerAsc: t('general.table.triggerAsc'),
cancelSort: t('general.table.cancelSort'),
}}
/>
<Link
to="/assets"
Expand Down
3 changes: 2 additions & 1 deletion src/pages/settings/settings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ import { AnalyticsService } from '../../service/analytics/AnalyticsService';
import { generalConfigService } from '../../storage/GeneralConfigService';
import { UserAsset, UserAssetConfig } from '../../models/UserAsset';
import AddressBook from './tabs/AddressBook/AddressBook';
import { getChainName } from '../../utils/utils';

const { Header, Content, Footer } = Layout;
const { TabPane } = Tabs;
Expand Down Expand Up @@ -162,7 +163,7 @@ const GeneralSettingsForm = props => {
return (
<Option value={asset.identifier} key={asset.identifier}>
{assetIcon(asset)}
{`${asset.name} (${asset.symbol})`}
{`${getChainName(asset.name, session.wallet.config)} (${asset.symbol})`}
</Option>
);
})}
Expand Down
3 changes: 2 additions & 1 deletion src/pages/settings/tabs/AddressBook/AddressBook.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import { Session } from '../../../../models/Session';
import { sessionState } from '../../../../recoil/atom';
import AddAddressModal from '../../../../components/AddressBookModal/AddAddressModal';
import ConfirmModal from '../../../../components/ConfirmModal/ConfirmModal';
import { getChainName } from '../../../../utils/utils';

const AddressBook = () => {
const [contacts, setContacts] = useState<AddressBookContact[]>([]);
Expand Down Expand Up @@ -53,7 +54,7 @@ const AddressBook = () => {
style={{ border: 'none', padding: '5px 14px', marginLeft: '10px' }}
color="processing"
>
{contact.chainName}
{getChainName(contact.chainName, session.wallet.config)}
</Tag>
);
},
Expand Down
Loading

0 comments on commit 019d542

Please sign in to comment.