Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/Transaction metadata #372

Merged
merged 32 commits into from
Dec 11, 2020
Merged
Show file tree
Hide file tree
Changes from 23 commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
8be3ef8
chore: bump @cardano-graphql/client-ts, minimal compat update
rhyslbw Oct 26, 2020
ee8d651
Transaction metadata updates
DeeJayElly Nov 9, 2020
755bcdb
Transaction metadata feature
DeeJayElly Nov 9, 2020
e482cf4
Transaction metadata feature
DeeJayElly Nov 9, 2020
eff876e
Merge branch 'develop' into feature/transaction-metadata
DeeJayElly Nov 21, 2020
c25d967
Merge branch 'develop' into feature/transaction-metadata
DeeJayElly Nov 21, 2020
5d51f59
Transaction metadata updates
DeeJayElly Nov 22, 2020
0980c82
Merge remote-tracking branch 'origin/feature/transaction-metadata' in…
DeeJayElly Nov 22, 2020
f925cc1
Transaction metadata feature
DeeJayElly Nov 22, 2020
5dd1a14
Transaction metadata feature - adding logic to show/hide unmoderated …
DeeJayElly Nov 22, 2020
45a93a6
Transaction metadata feature - adding logic to show/hide unmoderated …
DeeJayElly Nov 22, 2020
db81286
Transaction metadata feature - fixing build
DeeJayElly Nov 23, 2020
bb1cc13
Transaction metadata feature - fixing build errors
DeeJayElly Nov 24, 2020
2a45bc8
Transaction metadata feature - fixing build errors
DeeJayElly Nov 24, 2020
4f76157
Fix broken feature integration
DominikGuzei Nov 26, 2020
7f462da
Transaction metadata feature - fixing metadata display
DeeJayElly Nov 26, 2020
b738ccf
Transaction metadata feature - fixing metadata display
DeeJayElly Nov 30, 2020
1df7b82
Transaction metadata feature - fixing metadata display
DeeJayElly Nov 30, 2020
7f1d423
Transaction metadata feature - fixing metadata display
DeeJayElly Dec 1, 2020
fe72774
Transaction metadata feature - fixing translations
DeeJayElly Dec 1, 2020
e655f87
Transaction metadata feature - fixing metadata display
DeeJayElly Dec 1, 2020
3a078e7
Transaction metadata feature - fixing metadata display
DeeJayElly Dec 1, 2020
f213f86
Transaction metadata feature - fixing metadata display
DeeJayElly Dec 1, 2020
cae6607
Transaction metadata feature - fixing metadata translations
DeeJayElly Dec 3, 2020
76b7585
Transaction metadata feature - fixing metadata translations
DeeJayElly Dec 5, 2020
3f941d1
Transaction metadata feature - fixing metadata translations
DeeJayElly Dec 8, 2020
e6bc743
Transaction metadata feature - fixing metadata translations
DeeJayElly Dec 8, 2020
403ca05
Transaction metadata feature - fixing metadata translations
DeeJayElly Dec 8, 2020
70e1b5b
Transaction metadata feature - fixing metadata translations
DeeJayElly Dec 10, 2020
ad379a9
Transaction metadata feature - fixing metadata translations
DeeJayElly Dec 10, 2020
dc806ae
Transaction metadata feature - fixing metadata translations
DeeJayElly Dec 10, 2020
8ae058b
Transaction metadata feature - fixing metadata translations
DeeJayElly Dec 10, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion source/environment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export const environment = {
IS_SERVER: !isNavigatorDefined,
PACKAGE: {
HOMEPAGE: process.env.PACKAGE_HOMEPAGE,
VERSION: process.env.PACKAGE_VERSION
VERSION: process.env.PACKAGE_VERSION,
},
POLLING_INTERVAL: Number(process.env.POLLING_INTERVAL) || 10000,
};
Expand Down
8 changes: 4 additions & 4 deletions source/features/address/api/transformers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ export const paymentAddressDetailTransformer = (
s.utxos_aggregate?.aggregate?.sum?.value || '0'
),
transactionsCount:
s.transactions_aggregate?.aggregate?.count.toString() || '0'
}
s.transactions_aggregate?.aggregate?.count.toString() || '0',
};
};

export const stakeAddressDetailTransformer = (
Expand All @@ -31,6 +31,6 @@ export const stakeAddressDetailTransformer = (
s.withdrawals_aggregate?.aggregate?.sum?.amount || '0'
),
transactionsCount:
s.transactions_aggregate?.aggregate?.count.toString() || '0'
}
s.transactions_aggregate?.aggregate?.count.toString() || '0',
};
};
16 changes: 12 additions & 4 deletions source/features/address/ui/AddressSummary.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,19 @@ export interface IStakeAddressSummaryProps extends IAddressSummaryProps {
totalWithdrawals: string;
}

type AddressSummaryProps = IPaymentAddressSummaryProps | IStakeAddressSummaryProps
type AddressSummaryProps =
| IPaymentAddressSummaryProps
| IStakeAddressSummaryProps;

function isPaymentAddress (props: AddressSummaryProps): props is IPaymentAddressSummaryProps {
function isPaymentAddress(
props: AddressSummaryProps
): props is IPaymentAddressSummaryProps {
return (props as IPaymentAddressSummaryProps).finalBalance !== undefined;
}

function isStakeAddress (props: AddressSummaryProps): props is IStakeAddressSummaryProps {
function isStakeAddress(
props: AddressSummaryProps
): props is IStakeAddressSummaryProps {
return (props as IStakeAddressSummaryProps).totalWithdrawn !== undefined;
}

Expand Down Expand Up @@ -70,7 +76,9 @@ const AddressSummary = (props: AddressSummaryProps) => {
<div className={styles.infoLabel}>
{translate('address.totalWithdrawn')}
</div>
<div className={styles.infoValue}>{props.totalWithdrawn} ADA</div>
<div className={styles.infoValue}>
{props.totalWithdrawn} ADA
</div>
rhyslbw marked this conversation as resolved.
Show resolved Hide resolved
</div>
</>
)}
Expand Down
12 changes: 11 additions & 1 deletion source/features/i18n/translations/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@
"stakePoolsSearch": "Nach einem bestimmten Stake Pool suchen",
"stakePoolsTitle": "Stake Pools",
"unmoderated": "Sie haben zugestimmt, nicht moderierte Stake-Pool Daten anzuzeigen.",
"unmoderatedConfirmation": "Ja, nicht moderierten Inhalt anzeigen",
"unmoderatedContent": "Möchten Sie nicht moderierten Inhalt sehen?",
"unmoderatedEntitiesControl": "Diese Informationen werden von Stake-Pool-Betreibern bereitgestellt und gehostet und unterliegen nicht der Kontrolle der Unternehmen, die diese Website betreiben.",
"unmoderatedLeave": "Verlasse diese Seite",
Expand All @@ -161,13 +162,22 @@
"to": "Output-Adressen",
"id": "Transaktions-ID",
"includedIn": "Inkludiert in",
"metadata": "Metadata",
"noTransactions": "Keine Transaktionen",
"pageTitle": "Transaktion | $t(productTitle)",
"receivedTime": "Erhalten",
"summary": "Übersicht",
"totalOutput": "Output Insgesamt",
"transactionLabel": "Transaktion",
"transactionsLabel": "Transaktionen"
"transactionsLabel": "Transaktionen",
"unmoderated": "Sie haben zugestimmt, nicht moderierte Transaktion Daten anzuzeigen.",
"unmoderatedConfirmation": "Ja, nicht moderierten Inhalt anzeigen",
"unmoderatedContent": "Möchten Sie nicht moderierten Inhalt sehen?",
"unmoderatedEntitiesControl": "Diese Informationen werden von Stake-Pool-Betreibern bereitgestellt und gehostet und unterliegen nicht der Kontrolle der Unternehmen, die diese Website betreiben.",
"unmoderatedLeave": "Verlasse diese Seite",
"unmoderatedPoolTickerSymbols": "Transaktionen metadaten werden nicht moderiert und enthalten möglicherweise unangemessenen Inhalt.",
"unmoderatedTransactionData": "Transaktionen metadaten werden nicht moderiert",
"unmoderatedWarning": "Warnung:"
},
"withdrawals": "Abhebungen"
}
11 changes: 10 additions & 1 deletion source/features/i18n/translations/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -162,13 +162,22 @@
"to": "To addresses",
"id": "Transaction ID",
"includedIn": "Included In",
"metadata": "Metadata",
"noTransactions": "No Transactions",
"pageTitle": "Transaction | $t(productTitle)",
"receivedTime": "Received Time",
"summary": "Summary",
"totalOutput": "Total Output",
"transactionLabel": "Transaction",
"transactionsLabel": "Transactions"
"transactionsLabel": "Transactions",
"unmoderated": "You have consented to view unmoderated transaction data.",
"unmoderatedConfirmation": "Yes, show unmoderated content",
"unmoderatedContent": "Do you want to see unmoderated content?",
"unmoderatedEntitiesControl": "This information is provided and hosted by stake pool operators and it is not in control of entities running this website.",
"unmoderatedLeave": "Leave this page",
"unmoderatedPoolTickerSymbols": "Transaction metadata is not moderated and may contain inappropriate content.",
"unmoderatedTransactionData": "Transaction metadata data is not moderated",
"unmoderatedWarning": "Warning:"
},
"withdrawals": "Withdrawals"
}
12 changes: 11 additions & 1 deletion source/features/i18n/translations/ja.json
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@
"stakePoolsSearch": "特定のステークプールを検索する",
"stakePoolsTitle": "ステークプール",
"unmoderated": "あなたは管理されていないステークプールデータの表示に同意されています。",
"unmoderatedConfirmation": "はい、モデレートされていないコンテンツを表示します",
"unmoderatedContent": "管理されていないコンテンツを表示しますか。",
"unmoderatedEntitiesControl": "この情報はステークプールオペレーターが提供、ホストしており、本ウェブサイトを運営している組織の管理下にはありません。",
"unmoderatedLeave": "このページを離れる",
Expand All @@ -161,13 +162,22 @@
"to": "送信先",
"id": "トランザクションID",
"includedIn": "含まれるブロック",
"metadata": "メタデータ",
"noTransactions": "トランザクションはありません",
"pageTitle": "トランザクション | $t(productTitle)",
"receivedTime": "受信時間",
"summary": "概要",
"totalOutput": "総アウトプット",
"transactionLabel": "トランザクション",
"transactionsLabel": "トランザクション"
"transactionsLabel": "トランザクション",
"unmoderated": "モデレートされていないトランザクションデータを表示することに同意しました。",
"unmoderatedConfirmation": "はい、モデレートされていないコンテンツを表示します",
"unmoderatedContent": "管理されていないコンテンツを表示しますか。",
"unmoderatedEntitiesControl": "この情報はステークプールオペレーターが提供、ホストしており、本ウェブサイトを運営している組織の管理下にはありません。",
"unmoderatedLeave": "このページを離れる",
"unmoderatedPoolTickerSymbols": "トランザクションメタデータはモデレートされておらず、不適切なコンテンツが含まれている可能性があります。",
"unmoderatedTransactionData": "トランザクションメタデータデータはモデレートされません",
"unmoderatedWarning": "警告"
},
"withdrawals": "引き出し"
}
2 changes: 1 addition & 1 deletion source/features/search/api/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {
SearchForPaymentAddressQuery,
SearchForPaymentAddressQueryVariables,
SearchForStakeAddressQuery,
SearchForStakeAddressQueryVariables
SearchForStakeAddressQueryVariables,
} from '../../../typings/graphql-schema';
import searchByIdQuery from './searchById.graphql';
import searchForBlockByNumberQuery from './searchForBlockByNumber.graphql';
Expand Down
1 change: 1 addition & 0 deletions source/features/search/specs/helpers/exampleAddressData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ export const examplePaymentAddressData = {
fee: '0',
hash: '927edb96f3386ab91b5f5d85d84cb4253c65b1c2f65fa7df25f81fab1d62987a',
inputs: [],
metadata: [],
outputs: [
{
address:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ export const exampleTransactionData = {
fee: '0',
id: '927edb96f3386ab91b5f5d85d84cb4253c65b1c2f65fa7df25f81fab1d62987a',
inputs: [],
metadata: [],
outputs: [
{
address: 'Ae2tdPwUPEZ9vtyppa1FdJzvqJZkEcXgdHxVYAzTWcPaoNycVq5rc36LC1S',
Expand Down
16 changes: 8 additions & 8 deletions source/features/search/specs/searchForStakeAddress.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,15 @@ describe('Searching for a stake address summary', () => {
// 3. Access the observable search result provided by the store
await waitForExpect(() => {
expect(
parseFloat(search.store?.stakeAddressSearchResult?.totalWithdrawn as string)
).toBeGreaterThanOrEqual(
exampleStakeAddressData.totalWithdrawn
);
parseFloat(
search.store?.stakeAddressSearchResult?.totalWithdrawn as string
)
).toBeGreaterThanOrEqual(exampleStakeAddressData.totalWithdrawn);
expect(
parseInt(search.store?.stakeAddressSearchResult?.transactionsCount as string)
).toBeGreaterThanOrEqual(
exampleStakeAddressData.transactionsCount
);
parseInt(
search.store?.stakeAddressSearchResult?.transactionsCount as string
)
).toBeGreaterThanOrEqual(exampleStakeAddressData.transactionsCount);
});
});
});
31 changes: 23 additions & 8 deletions source/features/search/store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,14 @@ import { Store } from '../../lib/Store';
import { isDefined } from '../../lib/types';
import {
paymentAddressDetailTransformer,
stakeAddressDetailTransformer
stakeAddressDetailTransformer,
} from '../address/api/transformers';
import { ADDRESS_SEARCH_RESULT_PATH } from '../address/config';
import { IAddressSummary, IPaymentAddressSummary, IStakeAddressSummary } from '../address/types';
import {
IAddressSummary,
IPaymentAddressSummary,
IStakeAddressSummary,
} from '../address/types';
import { blockDetailsTransformer } from '../blocks/api/transformers';
import { BLOCK_SEARCH_RESULT_PATH } from '../blocks/config';
import { IBlockDetailed } from '../blocks/types';
Expand Down Expand Up @@ -36,8 +40,10 @@ export enum SearchType {
export class SearchStore extends Store {
@observable public blockSearchResult: IBlockDetailed | null = null;
@observable public epochSearchResult: IEpochOverview | null = null;
@observable public paymentAddressSearchResult: IPaymentAddressSummary | null = null;
@observable public stakeAddressSearchResult: IStakeAddressSummary | null = null;
@observable
public paymentAddressSearchResult: IPaymentAddressSummary | null = null;
@observable
public stakeAddressSearchResult: IStakeAddressSummary | null = null;
@observable public transactionSearchResult: ITransactionDetails | null = null;

private readonly searchApi: SearchApi;
Expand Down Expand Up @@ -75,7 +81,10 @@ export class SearchStore extends Store {
this.onSearchByEpochNumberRequested,
],
[this.searchActions.searchById, this.searchById],
[this.searchActions.searchForPaymentAddress, this.searchForPaymentAddress],
[
this.searchActions.searchForPaymentAddress,
this.searchForPaymentAddress,
],
[this.searchActions.searchForStakeAddress, this.searchForStakeAddress],
[
this.searchActions.searchForBlockByNumber,
Expand Down Expand Up @@ -196,7 +205,7 @@ export class SearchStore extends Store {
};

@action private searchForPaymentAddress = async ({
address
address,
}: {
address: string;
}) => {
Expand All @@ -222,7 +231,10 @@ export class SearchStore extends Store {
});
}
runInAction(() => {
this.paymentAddressSearchResult = paymentAddressDetailTransformer(address, result);
this.paymentAddressSearchResult = paymentAddressDetailTransformer(
address,
result
);
});
}
};
Expand Down Expand Up @@ -251,7 +263,10 @@ export class SearchStore extends Store {
});
}
runInAction(() => {
this.stakeAddressSearchResult = stakeAddressDetailTransformer(address, result);
this.stakeAddressSearchResult = stakeAddressDetailTransformer(
address,
result
);
});
}
};
Expand Down
Loading