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

fix: fix issues with deploy fetching and small improvements #1056

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
10 changes: 5 additions & 5 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@
"big.js": "^6.2.1",
"casper-cep18-js-client": "1.0.2",
"casper-js-sdk": "2.15.4",
"casper-wallet-core": "git+ssh://[email protected]:make-software/casper-wallet-core.git#v0.9.4",
"casper-wallet-core": "git+ssh://[email protected]:make-software/casper-wallet-core.git#v0.9.5",
"date-fns": "^2.30.0",
"i18next": "^23.11.0",
"i18next-browser-languagedetector": "^7.2.1",
Expand Down
28 changes: 14 additions & 14 deletions src/apps/popup/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,23 +24,23 @@ import { GlobalStyle, darkTheme, lightTheme } from '@libs/ui';

import { AppRouter } from './app-router';

const queryClient = new QueryClient({
defaultOptions: {
queries: {
staleTime: 3 * 60 * 1000,
refetchInterval: 3 * 60 * 1000,
gcTime: 3 * 60 * 1000,
retry: false
},
mutations: {
retry: false
}
}
});

const Tree = () => {
const [state, setState] = useState<PopupState | null>(null);

const queryClient = new QueryClient({
defaultOptions: {
queries: {
staleTime: 3 * 60 * 1000,
refetchInterval: 3 * 60 * 1000,
gcTime: 3 * 60 * 1000,
retry: false
},
mutations: {
retry: false
}
}
});

setCSPForSafari();

const isSystemDarkTheme = useSystemThemeDetector();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ export const Cep18ActionRows = ({ deploy }: Cep18ActionRowsProps) => {
title={title}
contractPackageHash={contractPackageHash}
contractName={contractName}
iconUrl={iconUrl || DeployIcon.Cep18Default}
additionalInfo="CEP-18 Token"
/>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ export const NftActionsRows = ({ deploy }: NftActionsRowsProps) => {
contractPackageHash={contractPackageHash}
contractName={contractName}
additionalInfo="CEP-47 NFT"
iconUrl={DeployIcon.NFTDefault}
iconUrl={iconUrl || DeployIcon.NFTDefault}
/>
);
};
15 changes: 11 additions & 4 deletions src/apps/popup/pages/deploy-details/components/common.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,11 @@ export const ContainerWithAmount = ({
fiatAmount
}: ActionContainerWithAmountProps) => (
<LeftAlignedFlexColumn gap={SpacingSize.Tiny}>
<AlignedFlexRow gap={SpacingSize.Small}>
<AlignedFlexRow gap={SpacingSize.Small} style={{ maxWidth: '296px' }}>
<Typography type="bodySemiBold">{title}</Typography>
<Typography type="bodyHash">{amount}</Typography>
<Typography type="bodyHash" ellipsis>
{amount}
</Typography>
<Typography type="bodyHash" color="contentSecondary">
CSPR
</Typography>
Expand Down Expand Up @@ -211,13 +213,18 @@ export const AmountRow = ({
const { t } = useTranslation();

return (
<AlignedFlexRowContainer gap={SpacingSize.Small}>
<AlignedFlexRowContainer
gap={SpacingSize.Small}
style={{ maxWidth: '296px' }}
>
{label && (
<Typography type="captionRegular" color="contentSecondary">
<Trans t={t}>{label}</Trans>
</Typography>
)}
<Typography type="bodyHash">{amount}</Typography>
<Typography type="bodyHash" ellipsis>
{amount}
</Typography>
<Typography type="bodyHash" color="contentSecondary">
{symbol}
</Typography>
Expand Down
20 changes: 6 additions & 14 deletions src/apps/popup/pages/deploy-details/content.tsx
Original file line number Diff line number Diff line change
@@ -1,15 +1,12 @@
import { IDeploy } from 'casper-wallet-core';
import React, { useEffect, useState } from 'react';
import { Trans, useTranslation } from 'react-i18next';
import { useSelector } from 'react-redux';
import styled from 'styled-components';

import { DeployDetailsAction } from '@popup/pages/deploy-details/components/deploy-details-action';
import { DeployDetailsResult } from '@popup/pages/deploy-details/components/deploy-details-result';
import { getEntryPointName } from '@popup/pages/deploy-details/utils';

import { selectVaultActiveAccount } from '@background/redux/vault/selectors';

import {
AlignedSpaceBetweenFlexRow,
BorderBottomPseudoElementProps,
Expand All @@ -22,7 +19,7 @@ import {
SpacingSize,
borderBottomPseudoElementRules
} from '@libs/layout';
import { dispatchFetchExtendedDeploysInfo } from '@libs/services/account-activity-service';
import { useFetchDeploy } from '@libs/services/deploys/use-fetch-deploy';
import {
DeployStatus,
Hash,
Expand Down Expand Up @@ -69,22 +66,17 @@ export const DeployDetailsPageContent = ({

const { t } = useTranslation();

const activeAccount = useSelector(selectVaultActiveAccount);

useEffect(() => {
setSingleDeploy(deploy);
}, [deploy]);

const { deployData } = useFetchDeploy(deploy?.deployHash);

useEffect(() => {
if (deploy?.deployHash && activeAccount?.publicKey) {
dispatchFetchExtendedDeploysInfo(
deploy.deployHash,
activeAccount?.publicKey
).then(({ payload: resp }) => {
setSingleDeploy(resp);
});
if (deployData) {
setSingleDeploy(deployData);
}
}, [activeAccount?.publicKey, deploy?.deployHash]);
}, [deployData]);

if (!singleDeploy) {
return null;
Expand Down
10 changes: 0 additions & 10 deletions src/background/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,7 @@ import {
} from '@background/redux/account-balances/actions';
import {
accountBalanceChanged,
accountCasperActivityCountChanged,
accountCep18TransferDeploysDataChanged,
accountCsprTransferDeploysDataChanged,
accountCurrencyRateChanged,
accountDeploysCountChanged,
accountDeploysDataChanged,
accountErc20Changed,
accountInfoReset,
accountNftTokensAdded,
Expand Down Expand Up @@ -619,18 +614,13 @@ runtime.onMessage.addListener(
case getType(recipientPublicKeyReseted):
case getType(accountBalanceChanged):
case getType(accountCurrencyRateChanged):
case getType(accountCsprTransferDeploysDataChanged):
case getType(accountInfoReset):
case getType(accountPendingDeployHashesChanged):
case getType(accountPendingDeployHashesRemove):
case getType(accountErc20Changed):
case getType(accountCep18TransferDeploysDataChanged):
case getType(accountDeploysDataChanged):
case getType(accountNftTokensAdded):
case getType(accountNftTokensUpdated):
case getType(accountNftTokensCountChanged):
case getType(accountDeploysCountChanged):
case getType(accountCasperActivityCountChanged):
case getType(accountTrackingIdOfSentNftTokensChanged):
case getType(accountTrackingIdOfSentNftTokensRemoved):
case getType(newContactAdded):
Expand Down
29 changes: 0 additions & 29 deletions src/background/redux/account-info/actions.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,5 @@
import { createAction } from 'typesafe-actions';

import {
AccountDeploysDataType,
Cep18TransferDeploysDataType,
CsprTransferDeploysDataType
} from '@background/redux/account-info/types';

import { AccountBalance } from '@libs/services/balance-service/types';
import { ContractPackageWithBalance } from '@libs/services/erc20-service/types';
import { NFTTokenResult } from '@libs/services/nft-service/types';
Expand All @@ -22,17 +16,6 @@ export const accountCurrencyRateChanged = createAction(
'ACCOUNT_CURRENCY_RATE_CHANGED'
)<number | null>();

export const accountCsprTransferDeploysDataChanged = createAction(
'ACCOUNT_CSPR_TRANSFER_DEPLOYS_DATA_CHANGED'
)<CsprTransferDeploysDataType>();

export const accountCep18TransferDeploysDataChanged = createAction(
'ACCOUNT_CEP18_TRANSFER_DEPLOYS_DATA_CHANGED'
)<{
cep18TransferDeploysData: Cep18TransferDeploysDataType;
contractPackageHash: string;
}>();

export const accountInfoReset = createAction('ACCOUNT_INFO_RESET')();

export const accountPendingDeployHashesChanged = createAction(
Expand All @@ -43,10 +26,6 @@ export const accountPendingDeployHashesRemove = createAction(
'ACCOUNT_PENDING_TRANSACTIONS_REMOVE'
)<string>();

export const accountDeploysDataChanged = createAction(
'ACCOUNT_DEPLOYS_DATA_CHANGED'
)<AccountDeploysDataType>();

export const accountNftTokensAdded = createAction('ACCOUNT_NFT_TOKENS_ADDED')<
NFTTokenResult[] | null
>();
Expand All @@ -59,14 +38,6 @@ export const accountNftTokensCountChanged = createAction(
'ACCOUNT_NFT_TOKENS_COUNT_CHANGED'
)<number>();

export const accountDeploysCountChanged = createAction(
'ACCOUNT_DEPLOYS_COUNT_CHANGED'
)<number>();

export const accountCasperActivityCountChanged = createAction(
'ACCOUNT_CASPER_ACTIVITY_COUNT_CHANGED'
)<number>();

export const accountTrackingIdOfSentNftTokensChanged = createAction(
'ACCOUNT_TRACKING_ID_OF_SENT_NFT_TOKENS_CHANGED'
)<{
Expand Down
Loading
Loading