Skip to content

Commit

Permalink
Merge branch 'release/1-5-0'
Browse files Browse the repository at this point in the history
  • Loading branch information
rhyslbw committed Apr 1, 2021
2 parents 6cb210b + bfd86ea commit 6233695
Show file tree
Hide file tree
Showing 55 changed files with 367 additions and 141 deletions.
21 changes: 21 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,27 @@
Changelog
=========

## 1.5.0

### Compatible with:

- [`cardano-graphql`: `4.0.0`](https://github.com/input-output-hk/cardano-graphql/releases/tag/4.0.0)

### Features
- add query to support fetching transaction metadata ([d5f4344](https://github.com/input-output-hk/cardano-explorer-app/commit/d5f4344959be2f0bdd4e59426e915c5d85283c0c)
- asset metadata in tooltip ([e44a98d](https://github.com/input-output-hk/cardano-explorer-app/commit/e44a98dd0a229601abd527fef77cb85f96d3964d)
- add global slot number support ([65c4a32](https://github.com/input-output-hk/cardano-explorer-app/commit/65c4a3279b0517f4d0e07f3d5b6188239130a0bb)
- add support link to footer ([957b3ad](https://github.com/input-output-hk/cardano-explorer-app/commit/957b3ad1378de2f3206b391e55cf4f923278452d)
- allow rewards query ([30b0c68](https://github.com/input-output-hk/cardano-explorer-app/commit/30b0c68d249c05ec1d50e2fd972056cb2641e0b4)

### Fixes
- remove stray acute character ([c67279a](https://github.com/input-output-hk/cardano-explorer-app/commit/c67279a3108595c6633932d670e442fef1a22ed6)
- infinite loading after block search ([b782199](https://github.com/input-output-hk/cardano-explorer-app/commit/b782199da40707a39932f3d4f5dc55e2b4da000d)
- use protocolVersion.major comparison to determine epoch slot count ([4c676d7](https://github.com/input-output-hk/cardano-explorer-app/commit/4c676d744eb2ca534b82635df7703d69722d966d)

### Refactorings
- replace use fingerprint from API ([2b5ca7c](https://github.com/input-output-hk/cardano-explorer-app/commit/2b5ca7c66a85bbac8a8fdead277bcd33d28ba13e)

## 1.4.0

### Compatible with:
Expand Down
8 changes: 7 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,16 @@ See [environment](source/environment.ts) for defaults.

## Build
This project uses an offline package cache to enable reproducible builds.

### yarn
```console
yarn --offline && yarn static:build
```

### nix
``` console
nix-build -A cardano-explorer-app
```
## Deploy
The static bundle can be deployed using a standard web server. A simple [Node.js program](deploy/index.js)
is available for deploying the build to an AWS S3 bucket.
Expand Down Expand Up @@ -55,4 +62,3 @@ The `master` and `develop` branches are continuously deployed, with PRs creating
[![Netlify Status](https://api.netlify.com/api/v1/badges/09492acb-61fd-4745-8b0e-60c8886f60d1/deploy-status)](https://cardano-explorer-mainnet.netlify.app)
#### Testnet
[![Netlify Status](https://api.netlify.com/api/v1/badges/16628b5d-b1f2-429b-a707-bbdec0564fe9/deploy-status)](https://cardano-explorer-testnet.netlify.app)

5 changes: 2 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "cardano-explorer-app",
"version": "1.4.0",
"version": "1.5.0",
"description": "Cardano Explorer App",
"author": "Daedalus Team @ Input Output HK",
"license": "Apache-2.0",
Expand Down Expand Up @@ -33,7 +33,6 @@
}
},
"dependencies": {
"@emurgo/cip14-js": "^2.0.0",
"@types/react-addons-css-transition-group": "15.0.5",
"bignumber.js": "9.0.1",
"browser-update": "3.3.9",
Expand Down Expand Up @@ -73,7 +72,7 @@
"@babel/plugin-transform-react-display-name": "7.8.3",
"@babel/plugin-transform-react-jsx-self": "7.9.0",
"@babel/plugin-transform-react-jsx-source": "7.9.0",
"@cardano-graphql/client-ts": "3.2.0",
"@cardano-graphql/client-ts": "^4.0.0",
"@cypress/webpack-preprocessor": "4.1.1",
"@graphql-codegen/cli": "1.2.0",
"@graphql-codegen/typescript": "1.2.0",
Expand Down
Binary file removed packages-cache/@cardano-graphql-client-ts-3.2.0.tgz
Binary file not shown.
Binary file not shown.
Binary file removed packages-cache/@emurgo-cip14-js-2.0.0.tgz
Binary file not shown.
Binary file removed packages-cache/bech32-2.0.0.tgz
Binary file not shown.
Binary file removed packages-cache/blake2b-2.1.3.tgz
Binary file not shown.
Binary file removed packages-cache/blake2b-wasm-1.1.7.tgz
Binary file not shown.
Binary file removed packages-cache/nanoassert-1.1.0.tgz
Binary file not shown.
3 changes: 2 additions & 1 deletion source/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ export enum BrandType {

export enum SearchType {
EPOCH = 'epoch',
BLOCK = 'block',
BLOCK_BY_NUMBER = 'blockByNumber',
BLOCK_BY_SLOT_NUMBER = 'blockBySlotNumber',
}

export enum CardanoNetwork {
Expand Down
6 changes: 3 additions & 3 deletions source/environment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ export const environment = {
CARDANO: {
ERA: (process.env.CARDANO_ERA as CardanoEra) || CardanoEra.BYRON,
GRAPHQL: {
HTTP_URL: `${process.env.GRAPHQL_API_PROTOCOL || 'https'}://${
HTTP_URL: `${process.env.GRAPHQL_API_PROTOCOL || 'http'}://${
process.env.GRAPHQL_API_HOST ||
'cardano-graphql-mainnet.daedalus-operations.com'
}:${process.env.GRAPHQL_API_PORT || '443'}/${
'localhost'
}:${process.env.GRAPHQL_API_PORT || '3100'}/${
process.env.GRAPHQL_API_PATH || ''
}`,
},
Expand Down
11 changes: 5 additions & 6 deletions source/features/address/api/transformers.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import { Currency } from 'cardano-js';
import {
Asset,
SearchForPaymentAddressQuery,
SearchForStakeAddressQuery, Token,
SearchForStakeAddressQuery,
} from '../../../../generated/typings/graphql-schema';
import { sortTokensDesc } from '../../../lib/arrays';
import { isDefined } from '../../../lib/types';
import { assetFingerprintFromToken } from '../../transactions/helpers';
import { assetTransformer } from '../../assets/api/transformers';
import { IPaymentAddressSummary, IStakeAddressSummary } from '../types';

export const paymentAddressDetailTransformer = (
Expand All @@ -20,12 +21,10 @@ export const paymentAddressDetailTransformer = (
tokensBalance:
s
.paymentAddresses![0]?.summary?.assetBalances?.filter(isDefined)
.filter(({ assetName }) => assetName !== 'ada')
.filter(({ asset }) => asset.assetName !== 'ada')
.map((t) => ({
...t,
asset: {
fingerprint: assetFingerprintFromToken(t as Token),
}
asset: assetTransformer(t.asset as Asset)
}))
.sort(sortTokensDesc) || [],
transactionsCount:
Expand Down
15 changes: 15 additions & 0 deletions source/features/assets/api/transformers.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { Asset } from '../../../../generated/typings/graphql-schema';
import { IAsset } from '../../transactions/types';

export const assetTransformer = (
asset: Asset
): IAsset => {
return {
...asset,
assetName: asset.assetName as string,
description: asset.description ? asset.description as string : undefined,
fingerprint: asset.fingerprint,
name: asset.name ? asset.name as string : undefined,
ticker: asset.ticker ? asset.ticker as string : undefined,
}
}
2 changes: 1 addition & 1 deletion source/features/blocks/api/BlockDetails.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

fragment BlockDetails on Block {
...BlockOverview
merkelRoot
merkleRoot
nextBlock {
hash
number
Expand Down
2 changes: 1 addition & 1 deletion source/features/blocks/api/BlockOverview.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ fragment BlockOverview on Block {
hash
number
size
slotInEpoch
slotNo
transactions_aggregate {
aggregate {
count
Expand Down
10 changes: 5 additions & 5 deletions source/features/blocks/api/transformers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export const blockOverviewTransformer = (
output: Currency.Util.lovelacesToAda(
b.transactions_aggregate?.aggregate?.sum?.totalOutput || '0'
),
slotWithinEpoch: formatSlotWithinEpoch(b.slotInEpoch),
slotNo: formatSlot(b.slotNo),
transactionsCount:
b.transactions_aggregate?.aggregate?.count.toString() || '0',
};
Expand All @@ -36,7 +36,7 @@ export const blockDetailsTransformer = (
b: BlockDetailsFragment
): IBlockDetailed => ({
...blockOverviewTransformer(b),
merkleRoot: b.merkelRoot || '',
merkleRoot: b.merkleRoot || '',
nextBlock: {
id: b.nextBlock?.hash || '',
number: b.nextBlock?.number || '-',
Expand Down Expand Up @@ -65,9 +65,9 @@ function formatCreatedBy(value: IBlockOverview['createdBy']): string {
}
}

function formatSlotWithinEpoch(
value: BlockOverviewFragment['slotInEpoch']
): IBlockOverview['slotWithinEpoch'] {
function formatSlot(
value: BlockOverviewFragment['slotNo']
): IBlockOverview['slotNo'] {
switch (value) {
case 0:
return value;
Expand Down
2 changes: 1 addition & 1 deletion source/features/blocks/specs/getLatestBlocks.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ describe('Blocks feature', () => {
await waitForExpect(() => {
expect(blocks.store.latestBlocks.length).toBe(10);
expect(blocks.store.latestBlocks[0].number).toBeDefined();
expect(blocks.store.latestBlocks[0].slotWithinEpoch).toBeDefined();
expect(blocks.store.latestBlocks[0].slotNo).toBeDefined();
expect(blocks.store.latestBlocks[4].transactionsCount).toBeDefined();
expect(blocks.store.latestBlocks[1].number).toBeDefined();
});
Expand Down
2 changes: 1 addition & 1 deletion source/features/blocks/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export interface IBlockOverview {
number: number | '-';
output: string;
size: number;
slotWithinEpoch: number | '-';
slotNo: number | '-';
transactionsCount: string;
}

Expand Down
8 changes: 6 additions & 2 deletions source/features/blocks/ui/BlockList.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,15 @@

:global {
.epoch {
width: 120px;
width: 40px;
}

.slotNo {
width: 80px;
}

.blocksSlots {
width: 100px;
width: 80px;
}

.createdAt {
Expand Down
26 changes: 20 additions & 6 deletions source/features/blocks/ui/BlockList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,21 +27,35 @@ const columns = (
return [
{
cellRender: (row: IBlockOverview) => {
const content = `${row.epoch} / ${row.slotWithinEpoch}`;
return isNumber(row.epoch) &&
isNumber(row.slotWithinEpoch) &&
!linksDisabled ? (
<LocalizedLink href={getEpochRoute(row.epoch)}>
{content}
{row.epoch}
</LocalizedLink>
) : (
<span>{content}</span>
<span>{row.epoch}</span>
);
},
cellValue: (row: IBlockOverview) => row,
cssClass: 'epoch',
head: 'block.epochSlotTitle',
key: 'epochsSlots',
head: 'block.epochTitle',
key: 'epoch',
},
{
cellRender: (row: IBlockOverview) => {
return isNumber(row.slotNo) &&
!linksDisabled ? (
<LocalizedLink href={getBlockRoute(row.id)}>
{row.slotNo}
</LocalizedLink>
) : (
<span>{row.slotNo}</span>
);
},
cellValue: (row: IBlockOverview) => row,
cssClass: 'slotNo',
head: 'block.slotNo',
key: 'slot',
},
{
cellRender: (row: IBlockOverview) => (
Expand Down
6 changes: 6 additions & 0 deletions source/features/blocks/ui/BlockSummary.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,12 @@ const BlockSummary = (props: BlockSummaryProps) => {
</div>
<div className={styles.infoValue}>{props.number}</div>
</div>
<div className={styles.infoRow}>
<div className={styles.infoLabel}>
{translate('blockSummary.slot')}
</div>
<div className={styles.infoValue}>{props.slotNo}</div>
</div>
<div className={styles.infoRow}>
<div className={styles.infoLabel}>
{translate('blockSummary.confirmations')}
Expand Down
2 changes: 1 addition & 1 deletion source/features/epochs/api/transformers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export const epochOverviewTransformer = (
percentage:
e.number === n.currentEpoch ? n.currentEpochPercentageComplete : 100,
slotsCount:
(!!e.blocks[0].protocolVersion
(e.blocks[0].protocolVersion.major > 1
? n.shelleyEpochLength
: n.byronSlotsPerEpoch) || 21600,
startedAt: new Date(e.startedAt),
Expand Down
4 changes: 2 additions & 2 deletions source/features/epochs/specs/helpers/latestEpochsExample.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export const latestEpochsExample = [
number: 31070,
output: '0',
size: 666,
slotWithinEpoch: 9486,
slotNo: 9486,
transactionsCount: '0',
},
] as IBlockOverview[],
Expand All @@ -34,7 +34,7 @@ export const latestEpochsExample = [
number: 31070,
output: '0',
size: 666,
slotWithinEpoch: 9486,
slotNo: 9486,
transactionsCount: '0',
},
] as IBlockOverview[],
Expand Down
8 changes: 6 additions & 2 deletions source/features/epochs/ui/EpochSummary.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,13 @@ const EpochSummary = ({ title, epoch }: IEpochSummaryProps) => {
<div className={styles.infoLabel}>
{translate('epochSummary.numberOfBlocks')}
</div>
<div className={styles.infoValue}>
{epoch.blocksCount} / {epoch.slotsCount}
<div className={styles.infoValue}>{epoch.blocksCount}</div>
</div>
<div className={styles.infoRow}>
<div className={styles.infoLabel}>
{translate('epochSummary.numberOfSlots')}
</div>
<div className={styles.infoValue}>{epoch.slotsCount}</div>
</div>
<div className={styles.infoRow}>
<div className={styles.infoLabel}>
Expand Down
9 changes: 7 additions & 2 deletions source/features/i18n/translations/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,11 @@
"blockTitle": "Block",
"createdAtTitle": "Erzeugt",
"createdByTitle": "Erzeugt von",
"epochSlotTitle": "Epoche / Slot",
"epochTitle": "Epoche",
"outputTitle": "Output (₳)",
"pageTitle": "Block | $t(productTitle)",
"sizeTitle": "Größe (Bytes)",
"slot": "Slot",
"summary": "Block Übersicht",
"transactionsTitle": "Transaktionen"
},
Expand All @@ -32,6 +33,7 @@
"nextBlock": "Nächster Block",
"previousBlock": "Voriger Block",
"size": "Größe",
"slot": "Slot",
"time": "Zeitpunkt",
"transactions": "Transaktionen"
},
Expand Down Expand Up @@ -62,6 +64,7 @@
"epochSummaryTitle": "Epoche Übersicht",
"lastBlockAt": "Letzter Block",
"numberOfBlocks": "Anzahl an Blöcken",
"numberOfSlots": "Anzahl an Slots",
"startedAt": "Gestartet",
"totalOutput": "Output insgesamt",
"transactions": "Transaktionen"
Expand All @@ -87,6 +90,7 @@
"ouroborosAlgorithm": "Ouroboros Algorythmus",
"project": "Projekt.",
"shellyExplorer": "Shelley Explorer",
"submitASupportRequest": "Senden Sie eine Supportanfrage",
"textTitle": "Cardano ist ein",
"whyCardano": "Warum Cardano"
},
Expand Down Expand Up @@ -128,7 +132,8 @@
"notExist": "Adresse existiert nicht:",
"notFound": "Es tut uns Leid, wir konnten keine Ergebnisse finden zu:",
"placeholder": "Suche nach Epochen, Blöcken, Addressen und Transaktionen",
"suggestion_block": "Suche nach einem Block",
"suggestion_block_by_number": "Suchen Sie nach einem Block nach Nummer",
"suggestion_block_by_slot": "Suchen Sie nach einem Block nach Slot",
"suggestion_epoch": "Suche nach einer Epoche",
"title": "Suche"
},
Expand Down
Loading

0 comments on commit 6233695

Please sign in to comment.