Skip to content

Commit 019d542

Browse files
authored
Merge pull request #835 from crypto-com/dev
Internal Release v0.5.6
2 parents 588771c + 88ce9cc commit 019d542

File tree

20 files changed

+338
-131
lines changed

20 files changed

+338
-131
lines changed

CHANGELOG.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,16 @@ All notable changes to this project will be documented in this file.
66

77
*Released*
88

9+
## [v0.5.6] - 2021-11-23
10+
11+
### Additions
12+
- Align on Chain namings
13+
- CRC20 data support
14+
15+
### Bug fixes
16+
- Added missing bridge history records for custom destination addresses
17+
- Fixed validator list auto-filling in redelegate form
18+
919
## [v0.5.5] - 2021-11-17
1020

1121
### Additions

package.json

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "chain-desktop-wallet",
3-
"version": "0.5.5",
3+
"version": "0.5.6",
44
"description": "Crypto.com Chain Desktop Wallet App",
55
"repository": "github:crypto-com/chain-desktop-wallet",
66
"author": "Crypto.org <[email protected]>",
@@ -73,7 +73,7 @@
7373
"zxcvbn": "4.4.2"
7474
},
7575
"scripts": {
76-
"run-audit": "yarn audit-ci --high -a 1002475 1002627 1002477 1002522 1002590",
76+
"run-audit": "yarn audit-ci --high -a 1002475 1002627 1002477 1002522 1002590 1005059",
7777
"start": "node scripts/start.js",
7878
"build": "cross-env NODE_OPTIONS=--max_old_space_size=8192 && yarn clean-builds && node scripts/build.js",
7979
"test": "node scripts/test.js --watchAll=false",
@@ -256,7 +256,7 @@
256256
"terser-webpack-plugin": "4.2.3",
257257
"wait-on": "5.2.1",
258258
"webpack": "4.44.2",
259-
"webpack-dev-server": "3.11.0",
259+
"webpack-dev-server": "3.11.2",
260260
"webpack-manifest-plugin": "2.2.0",
261261
"workbox-webpack-plugin": "5.1.4"
262262
},
@@ -329,6 +329,7 @@
329329
"css-what": "5.0.1",
330330
"trim-newlines": "3.0.1",
331331
"normalize-url": "5.3.1",
332-
"tar": "6.1.9"
332+
"tar": "6.1.9",
333+
"glob-parent": "5.1.2"
333334
}
334335
}

src/components/AddressBookModal/AddAddressModal.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import { Session } from '../../models/Session';
1111
import { AddressBookService } from '../../service/AddressBookService';
1212
import { TransactionUtils } from '../../utils/TransactionUtils';
1313
import { walletAllAssetsState } from '../../recoil/atom';
14+
import { getChainName } from '../../utils/utils';
1415

1516
const { Option } = Select;
1617

@@ -186,7 +187,7 @@ const AddAddressModal = (props: IAddAddressModalProps) => {
186187
{SupportedNetworks.map(network => {
187188
return (
188189
<Option key={network.label} value={network.label}>
189-
{network.label}
190+
{getChainName(network.label, currentSession.wallet.config)}
190191
</Option>
191192
);
192193
})}

src/config/StaticAssets.ts

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,14 @@
11
// Every created wallet get initialized with a new CRO asset
2-
import { CroNetwork } from '@crypto-org-chain/chain-jslib/lib/dist/core/cro';
32
import { getRandomId } from '../crypto/RandomGen';
43
import { AssetCreationType, UserAssetConfig, UserAssetType } from '../models/UserAsset';
5-
import { Network, WalletConfig } from './StaticConfig';
4+
import { WalletConfig, SupportedChainName } from './StaticConfig';
5+
import { checkIfTestnet } from '../utils/utils';
66
import iconCronosSvg from '../assets/icon-cronos-blue.svg';
77
import iconCroSvg from '../assets/icon-cro.svg';
88

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

12-
const checkIfTestnet = (network: Network) => {
13-
return (
14-
[CroNetwork.TestnetCroeseid3, CroNetwork.TestnetCroeseid4, CroNetwork.Testnet].includes(
15-
network,
16-
) || network.defaultNodeUrl.includes('testnet')
17-
);
18-
};
19-
2012
// Every created wallet get initialized with a new CRO asset
2113
export const CRO_ASSET = (walletConfig: WalletConfig) => {
2214
const { network } = walletConfig;
@@ -42,7 +34,7 @@ export const CRO_ASSET = (walletConfig: WalletConfig) => {
4234
// 'https://s3-ap-southeast-1.amazonaws.com/monaco-cointrack-production/uploads/coin/colorful_logo/5c1248c15568a4017c20aa87/cro.png',
4335
iconCroSvg,
4436
identifier: getRandomId(),
45-
name: 'Crypto.org Chain',
37+
name: SupportedChainName.CRYPTO_ORG,
4638
symbol: assetSymbol,
4739
mainnetSymbol: 'CRO', // This is to be used solely for markets data since testnet market prices is always non existent
4840
stakedBalance: '0',
@@ -94,7 +86,7 @@ export const CRONOS_ASSET = (walletConfig: WalletConfig) => {
9486
// 'https://firebasestorage.googleapis.com/v0/b/chain-desktop-wallet.appspot.com/o/cronos_logo.png?alt=media&token=781c48a3-e89e-4dd4-87d3-d1a1b8e2e456',
9587
iconCronosSvg,
9688
identifier: getRandomId(),
97-
name: 'Cronos Chain',
89+
name: SupportedChainName.CRONOS,
9890
symbol: isTestnet ? 'TCRO' : 'CRO',
9991
mainnetSymbol: 'CRO', // This is to be used solely for markets data since testnet market prices is always non existent
10092
stakedBalance: '0',

src/config/StaticConfig.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -158,16 +158,21 @@ SUPPORTED_CURRENCY.set('CZK', { value: 'CZK', label: 'CZK - Kč', symbol: 'Kč'
158158
SUPPORTED_CURRENCY.set('BRL', { value: 'BRL', label: 'BRL - R$', symbol: 'R$' });
159159
SUPPORTED_CURRENCY.set('TRY', { value: 'TRY', label: 'TRY - ₺', symbol: '₺' });
160160

161+
export enum SupportedChainName {
162+
CRYPTO_ORG = 'Crypto.org Chain',
163+
CRONOS = 'Cronos Chain',
164+
}
165+
161166
export interface SupportedBridge {
162167
value: string;
163168
label: string;
164169
}
165170

166171
export const SUPPORTED_BRIDGE = new Map<string, SupportedBridge>();
167-
SUPPORTED_BRIDGE.set('CRONOS', { value: 'CRONOS', label: 'Cronos Chain' });
172+
SUPPORTED_BRIDGE.set('CRONOS', { value: 'CRONOS', label: SupportedChainName.CRONOS });
168173
SUPPORTED_BRIDGE.set('CRYPTO_ORG', {
169174
value: 'CRYPTO_ORG',
170-
label: 'Crypto.org Chain',
175+
label: SupportedChainName.CRYPTO_ORG,
171176
});
172177

173178
export const SUPPORTED_BRIDGES_ASSETS = ['CRO'];

src/models/AddressBook.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { UserAssetType } from './UserAsset';
2+
import { SupportedChainName } from '../config/StaticConfig';
23

34
export interface AddressBookContact {
45
id: string;
@@ -24,11 +25,11 @@ interface AddressBookNetwork {
2425

2526
const SupportedNetworks: AddressBookNetwork[] = [
2627
{
27-
label: 'Cronos Chain',
28+
label: SupportedChainName.CRONOS,
2829
networkType: UserAssetType.EVM,
2930
},
3031
{
31-
label: 'Crypto.org Chain',
32+
label: SupportedChainName.CRYPTO_ORG,
3233
networkType: UserAssetType.TENDERMINT,
3334
},
3435
];

src/pages/assets/assets.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ import { AnalyticsService } from '../../service/analytics/AnalyticsService';
2525
import ReceiveDetail from './components/ReceiveDetail';
2626
import FormSend from './components/FormSend';
2727
import { walletService } from '../../service/WalletService';
28-
import { middleEllipsis } from '../../utils/utils';
28+
import { getChainName, middleEllipsis } from '../../utils/utils';
2929
import {
3030
TransactionDirection,
3131
TransactionStatus,
@@ -192,7 +192,7 @@ const AssetsPage = () => {
192192
style={{ border: 'none', padding: '5px 14px', marginLeft: '10px' }}
193193
color="processing"
194194
>
195-
{name}
195+
{getChainName(name, session.wallet.config)}
196196
</Tag>
197197
);
198198
},
@@ -397,7 +397,7 @@ const AssetsPage = () => {
397397
style={{ border: 'none', padding: '5px 14px', marginLeft: '10px' }}
398398
color="processing"
399399
>
400-
{currentAsset?.name}
400+
{getChainName(currentAsset?.name, session.wallet.config)}
401401
</Tag>
402402
</div>
403403
<div className="value">

src/pages/bridge/bridge.tsx

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ import { walletService } from '../../service/WalletService';
3737
import { UserAsset } from '../../models/UserAsset';
3838
import { BroadCastResult } from '../../models/Transaction';
3939
import { renderExplorerUrl } from '../../models/Explorer';
40-
import { getAssetBySymbolAndChain, middleEllipsis } from '../../utils/utils';
40+
import { getAssetBySymbolAndChain, getChainName, middleEllipsis } from '../../utils/utils';
4141
import { TransactionUtils } from '../../utils/TransactionUtils';
4242
import {
4343
adjustedTransactionAmount,
@@ -318,8 +318,8 @@ const CronosBridge = props => {
318318
<>
319319
<div>
320320
<span>
321-
{t('bridge.form.from')} {bridgeFromObj?.label} {t('bridge.form.to')}{' '}
322-
{bridgeToObj?.label}
321+
{t('bridge.form.from')} {getChainName(bridgeFromObj?.label, session.wallet.config)}{' '}
322+
{t('bridge.form.to')} {getChainName(bridgeToObj?.label, session.wallet.config)}
323323
</span>
324324
</div>
325325
{session.wallet.walletType === LEDGER_WALLET_TYPE ? (
@@ -607,7 +607,9 @@ const CronosBridge = props => {
607607
</Sider>
608608
<Content>
609609
<div>{t('bridge.form.from')}</div>
610-
<div style={{ fontWeight: 'bold' }}>{bridgeFromObj?.label}</div>
610+
<div style={{ fontWeight: 'bold' }}>
611+
{getChainName(bridgeFromObj?.label, session.wallet.config)}
612+
</div>
611613
</Content>
612614
</Layout>
613615
<ArrowRightOutlined style={{ fontSize: '24px', width: '50px' }} />
@@ -617,7 +619,9 @@ const CronosBridge = props => {
617619
</Sider>
618620
<Content>
619621
<div>{t('bridge.form.to')}</div>
620-
<div style={{ fontWeight: 'bold' }}>{bridgeToObj?.label}</div>
622+
<div style={{ fontWeight: 'bold' }}>
623+
{getChainName(bridgeToObj?.label, session.wallet.config)}
624+
</div>
621625
</Content>
622626
</Layout>
623627
</div>
@@ -811,7 +815,9 @@ const CronosBridge = props => {
811815
{bridgeIcon(bridgeFromObj?.value)}
812816
</Sider>
813817
<Content>
814-
<div style={{ fontWeight: 'bold' }}>{bridgeFromObj?.label}</div>
818+
<div style={{ fontWeight: 'bold' }}>
819+
{getChainName(bridgeFromObj?.label, session.wallet.config)}
820+
</div>
815821
</Content>
816822
</Layout>
817823
<ArrowRightOutlined style={{ fontSize: '24px', width: '50px' }} />
@@ -820,7 +826,9 @@ const CronosBridge = props => {
820826
{bridgeIcon(bridgeToObj?.value)}
821827
</Sider>
822828
<Content>
823-
<div style={{ fontWeight: 'bold' }}>{bridgeToObj?.label}</div>
829+
<div style={{ fontWeight: 'bold' }}>
830+
{getChainName(bridgeToObj?.label, session.wallet.config)}
831+
</div>
824832
</Content>
825833
</Layout>
826834
</div>

src/pages/bridge/components/BridgeTransactionHistory.tsx

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,9 @@ import {
1010
bech32ToEVMAddress,
1111
middleEllipsis,
1212
getCronosAsset,
13+
getCryptoOrgAsset,
1314
getAssetBySymbolAndChain,
15+
getChainName,
1416
} from '../../../utils/utils';
1517

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

3234
// eslint-disable-next-line
3335
const cronosAsset = getCronosAsset(walletAllAssets);
36+
const cryptoOrgAsset = getCryptoOrgAsset(walletAllAssets);
3437

3538
const bridgeService = new BridgeService(walletService.storageService);
3639

@@ -173,7 +176,7 @@ const BridgeTransactionHistory = () => {
173176
</>
174177
}
175178
>
176-
({source.chain.replace('-', ' ')})
179+
({getChainName(source.chain.replace('-', ' '), session.wallet.config)})
177180
</Tooltip>
178181
</>
179182
);
@@ -232,10 +235,10 @@ const BridgeTransactionHistory = () => {
232235
</>
233236
}
234237
>
235-
({destination.chain.replace('-', ' ')})
238+
({getChainName(destination.chain.replace('-', ' '), session.wallet.config)})
236239
</Tooltip>
237240
) : (
238-
<>({destination.chain.replace('-', ' ')})</>
241+
<>({getChainName(destination.chain.replace('-', ' '), session.wallet.config)})</>
239242
)}
240243
</>
241244
);
@@ -271,7 +274,7 @@ const BridgeTransactionHistory = () => {
271274
useEffect(() => {
272275
const fetchBridgeHistory = async () => {
273276
if (cronosAsset) {
274-
await bridgeService.fetchAndSaveBridgeTxs(cronosAsset?.address!);
277+
await bridgeService.fetchAndSaveBridgeTxs(cronosAsset?.address!, cryptoOrgAsset?.address!);
275278
}
276279
const transactionHistory = await bridgeService.retrieveCurrentWalletBridgeTransactions();
277280
const processedHistory = convertBridgeTransfers(transactionHistory);

src/pages/bridge/components/CronosBridgeForm.tsx

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,12 @@ import { useTranslation } from 'react-i18next';
88
import { AddressType } from '@crypto-org-chain/chain-jslib/lib/dist/utils/address';
99
import { sessionState, walletAllAssetsState } from '../../../recoil/atom';
1010
import { scaledBalance, UserAsset, UserAssetType } from '../../../models/UserAsset';
11-
import { middleEllipsis, getCryptoOrgAsset, getCronosAsset } from '../../../utils/utils';
11+
import {
12+
middleEllipsis,
13+
getCryptoOrgAsset,
14+
getCronosAsset,
15+
getChainName,
16+
} from '../../../utils/utils';
1217
import { fromScientificNotation, getCurrentMinAssetAmount } from '../../../utils/NumberUtils';
1318
import {
1419
SUPPORTED_BRIDGE,
@@ -374,7 +379,7 @@ const CronosBridgeForm = props => {
374379
return (
375380
<Option value={bridge.value} key={bridge.value}>
376381
{bridgeIcon(bridge.value)}
377-
{`${bridge.label}`}
382+
{`${getChainName(bridge.label, session.wallet.config)}`}
378383
</Option>
379384
);
380385
})}
@@ -454,7 +459,7 @@ const CronosBridgeForm = props => {
454459
return (
455460
<Option value={bridge.value} key={bridge.value}>
456461
{bridgeIcon(bridge.value)}
457-
{`${bridge.label}`}
462+
{`${getChainName(bridge.label, session.wallet.config)}`}
458463
</Option>
459464
);
460465
})}

0 commit comments

Comments
 (0)