Skip to content

Commit

Permalink
[Issue-1780] Update type evmWatchTransactionRequest
Browse files Browse the repository at this point in the history
  • Loading branch information
dominhquang committed Sep 7, 2024
1 parent 12a5ad2 commit 49b973d
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 6 deletions.
8 changes: 6 additions & 2 deletions src/screens/Confirmations/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -192,10 +192,13 @@ export const Confirmations = () => {
account = request.account;
canSign = !_isMessage || !account.isHardware;
isMessage = _isMessage;
} else if (confirmation.type === 'evmSignatureRequest' || confirmation.type === 'evmSendTransactionRequest') {
} else if (
['evmSignatureRequest', 'evmSendTransactionRequest', 'evmWatchTransactionRequest'].includes(confirmation.type)
) {
const request = confirmation.item as ConfirmationDefinitions[
| 'evmSignatureRequest'
| 'evmSendTransactionRequest'][0];
| 'evmSendTransactionRequest'
| 'evmWatchTransactionRequest'][0];

account = request.payload.account;
canSign = request.payload.canSign;
Expand Down Expand Up @@ -244,6 +247,7 @@ export const Confirmations = () => {
navigation={navigation}
/>
);
case 'evmWatchTransactionRequest':
case 'evmSendTransactionRequest':
return (
<EvmTransactionConfirmation
Expand Down
6 changes: 3 additions & 3 deletions src/screens/Confirmations/variants/Transaction/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -130,11 +130,11 @@ export const TransactionConfirmation = (props: Props) => {
txExpirationTime={txExpirationTime}
/>
)}
{type === 'evmSendTransactionRequest' && (
{(type === 'evmSendTransactionRequest' || type === 'evmWatchTransactionRequest') && (
<EvmSignArea
id={item.id}
payload={item as ConfirmationDefinitions['evmSendTransactionRequest'][0]}
type="evmSendTransactionRequest"
payload={item as ConfirmationDefinitions['evmSendTransactionRequest' | 'evmWatchTransactionRequest'][0]}
type={type}
navigation={navigation}
txExpirationTime={txExpirationTime}
/>
Expand Down
1 change: 1 addition & 0 deletions src/stores/base/RequestState.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ export const CONFIRMATIONS_FIELDS: Array<keyof RequestState> = [
'addTokenRequest',
'evmSignatureRequest',
'evmSendTransactionRequest',
'evmWatchTransactionRequest',
'errorConnectNetwork',
'connectWCRequest',
];
Expand Down
2 changes: 1 addition & 1 deletion src/types/confirmation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { ConfirmationDefinitions } from '@subwallet/extension-base/background/Ko

export type EvmSignatureSupportType = keyof Pick<
ConfirmationDefinitions,
'evmSignatureRequest' | 'evmSendTransactionRequest'
'evmSignatureRequest' | 'evmSendTransactionRequest' | 'evmWatchTransactionRequest'
>;

export type EvmErrorSupportType = keyof Pick<ConfirmationDefinitions, 'errorConnectNetwork'>;

0 comments on commit 49b973d

Please sign in to comment.