Skip to content

Commit

Permalink
Send form fixes
Browse files Browse the repository at this point in the history
Fix accelerate dialog flicker;
Fix send 0 ETH;
Fix custom gas dialog inside accelerate tx dialog;
  • Loading branch information
everdimension committed Dec 27, 2024
1 parent 1d0f502 commit 9d90936
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 14 deletions.
14 changes: 7 additions & 7 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 @@ -106,7 +106,7 @@
"@walletconnect/jsonrpc-utils": "^1.0.8",
"@zeriontech/components": "^1.0.3",
"@zeriontech/hardware-wallet-connection": "^1.0.11",
"@zeriontech/transactions": "^0.2.0",
"@zeriontech/transactions": "^0.2.1",
"bignumber.js": "^9.1.1",
"buffer": "^6.0.3",
"canvas-confetti": "^1.6.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ export function SpeedUp({
chainGasPrices: acceleratedGasPrices,
networkFeeConfiguration: configuration.networkFee,
onFeeValueCommonReady: handleFeeValueCommonReady,
keepPreviousData: true,
});

const signTxBtnRef = useRef<SendTxBtnHandle | null>(null);
Expand Down
12 changes: 9 additions & 3 deletions src/ui/pages/SendForm/SendForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ import { useWalletPortfolio } from 'src/modules/zerion-api/hooks/useWalletPortfo
import { useHttpClientSource } from 'src/modules/zerion-api/hooks/useHttpClientSource';
import { assertProp } from 'src/shared/assert-property';
import { useGasbackEstimation } from 'src/modules/ethereum/account-abstraction/rewards';
import { getError } from 'src/shared/errors/getError';
import {
DEFAULT_CONFIGURATION,
applyConfiguration,
Expand Down Expand Up @@ -550,8 +551,11 @@ function SendFormComponent() {
</form>
<Spacer height={16} />
<ErrorBoundary
renderError={() => (
<UIText kind="body/regular">
// TODO:
// Once this error boundary kicks in, we no longer render EstimateTransactionGas
// and therefore never refetch gas, even when form values change
renderError={(error) => (
<UIText kind="body/regular" title={error?.message}>
<span style={{ display: 'inline-block' }}>
<WarningIcon />
</span>{' '}
Expand Down Expand Up @@ -585,7 +589,9 @@ function SendFormComponent() {
);
}
if (gasQuery.isError) {
throw new Error('Failed to estimate gas');
throw new Error(
`Failed to estimate gas (${getError(gasQuery.error).message})`
);
}
return transaction && chain && transaction.gas ? (
<React.Suspense
Expand Down
12 changes: 9 additions & 3 deletions src/ui/pages/SendTransaction/NetworkFee/NetworkFeeDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -585,7 +585,11 @@ export const NetworkFeeDialog = React.forwardRef<
containerStyle={{
['--surface-background-color' as string]: 'transparent',
}}
onClosed={() => setView('default')}
onClosed={() => {
if (!customViewOnly) {
setView('default');
}
}}
>
{view === 'default' ? (
<>
Expand Down Expand Up @@ -685,10 +689,12 @@ export const NetworkFeeDialog = React.forwardRef<
chain={chain}
value={value}
onSubmit={(value) => {
if (!customViewOnly) {
onSubmit(value);
if (customViewOnly) {
onDismiss();
} else {
setView('default');
}
onSubmit(value);
}}
transaction={transaction}
chainGasPrices={chainGasPrices}
Expand Down

0 comments on commit 9d90936

Please sign in to comment.