From a3cdc477c22e4d061f910a8476f2501f4226c765 Mon Sep 17 00:00:00 2001 From: "razvan.tomegea" Date: Fri, 1 Nov 2024 18:38:54 +0200 Subject: [PATCH 1/6] Ability to show transaction toast on demand --- .../components/CustomToast/CustomToast.tsx | 14 +++++++++++ .../CustomToast/customToast.types.ts | 4 ++++ .../TransactionToast/TransactionToast.tsx | 24 +++++++++---------- .../TransactionToast/transactionToast.type.ts | 10 +++++--- .../utils/getToastDataStateByStatus.ts | 5 ++-- .../components/TransactionToastGuard.tsx | 1 + src/types/toasts.types.ts | 8 ++++++- 7 files changed, 48 insertions(+), 18 deletions(-) diff --git a/src/UI/TransactionsToastList/components/CustomToast/CustomToast.tsx b/src/UI/TransactionsToastList/components/CustomToast/CustomToast.tsx index 941e2b599..cc5aaa096 100644 --- a/src/UI/TransactionsToastList/components/CustomToast/CustomToast.tsx +++ b/src/UI/TransactionsToastList/components/CustomToast/CustomToast.tsx @@ -2,6 +2,8 @@ import React from 'react'; import { IconToast, SimpleToast, CustomComponentToast } from './components'; import { CustomToastPropsType } from './customToast.types'; import { useRemoveCustomToast } from './helpers'; +import { TransactionToast } from '../TransactionToast'; +import { TransactionToastType } from 'types/toasts.types'; export const CustomToast = (props: CustomToastPropsType) => { const { duration, onDelete } = props; @@ -11,6 +13,18 @@ export const CustomToast = (props: CustomToastPropsType) => { return ; } + const customToastProps = props as unknown as TransactionToastType; + + if (customToastProps.transaction) { + return ( + + ); + } + if (props.icon) { return ; } diff --git a/src/UI/TransactionsToastList/components/CustomToast/customToast.types.ts b/src/UI/TransactionsToastList/components/CustomToast/customToast.types.ts index 134d423c6..140b94f26 100644 --- a/src/UI/TransactionsToastList/components/CustomToast/customToast.types.ts +++ b/src/UI/TransactionsToastList/components/CustomToast/customToast.types.ts @@ -18,12 +18,16 @@ type SharedCustomToastPropsType = WithClassnameType & { export type MessageCustomToastPropsType = SharedCustomToastPropsType & MessageCustomToastType; + export type MessageIconToastPropsType = SharedCustomToastPropsType & MessageIconToastType; + export type TransactionIconToastPropsType = SharedCustomToastPropsType & TransactionIconToastType; + export type ComponentIconToastPropsType = SharedCustomToastPropsType & ComponentIconToastType; + export type CustomToastPropsType = | MessageCustomToastPropsType | MessageIconToastPropsType diff --git a/src/UI/TransactionsToastList/components/TransactionToast/TransactionToast.tsx b/src/UI/TransactionsToastList/components/TransactionToast/TransactionToast.tsx index 027fe89cc..b9b7bf1cb 100644 --- a/src/UI/TransactionsToastList/components/TransactionToast/TransactionToast.tsx +++ b/src/UI/TransactionsToastList/components/TransactionToast/TransactionToast.tsx @@ -18,17 +18,17 @@ export interface TransactionToastPropsType } const TransactionToastComponent = ({ - toastId, - title = '', className = 'dapp-transaction-toast', - onDelete, - startTimestamp, + customization, endTimeProgress, lifetimeAfterSuccess, + onDelete, + startTimestamp, status, - transactions, - customization, - styles + styles, + title = '', + toastId, + transactions }: TransactionToastPropsType & WithStylesImportType) => { const { isCrossShard, @@ -62,14 +62,14 @@ const TransactionToastComponent = ({ isCrossShard={isCrossShard} > diff --git a/src/UI/TransactionsToastList/components/TransactionToast/transactionToast.type.ts b/src/UI/TransactionsToastList/components/TransactionToast/transactionToast.type.ts index 122d680b1..2db821fb8 100644 --- a/src/UI/TransactionsToastList/components/TransactionToast/transactionToast.type.ts +++ b/src/UI/TransactionsToastList/components/TransactionToast/transactionToast.type.ts @@ -1,14 +1,18 @@ import { FontAwesomeIconProps } from '@fortawesome/react-fontawesome'; -import { SignedTransactionType, TransactionBatchStatusesEnum } from 'types'; +import { + SignedTransactionType, + TransactionBatchStatusesEnum, + TransactionServerStatusesEnum +} from 'types'; import { ProgressProps } from 'UI/Progress'; import { TransactionDetailsType } from 'UI/TransactionDetails'; import { ComponentTypeWithChildren } from '../types'; -import { TransactionToastContentProps } from './components/TransactionToastContent'; +import { TransactionToastContentProps } from './components'; export interface TransactionToastDefaultProps { toastId: string; transactions?: SignedTransactionType[]; - status?: TransactionBatchStatusesEnum; + status?: TransactionBatchStatusesEnum | TransactionServerStatusesEnum; classes?: Record; lifetimeAfterSuccess?: number; endTimeProgress?: number; diff --git a/src/UI/TransactionsToastList/components/TransactionToast/utils/getToastDataStateByStatus.ts b/src/UI/TransactionsToastList/components/TransactionToast/utils/getToastDataStateByStatus.ts index 650a01eb6..fb07d25f5 100644 --- a/src/UI/TransactionsToastList/components/TransactionToast/utils/getToastDataStateByStatus.ts +++ b/src/UI/TransactionsToastList/components/TransactionToast/utils/getToastDataStateByStatus.ts @@ -8,7 +8,8 @@ import { import { TransactionBatchStatusesEnum, TransactionsDefaultTitles, - TransactionsDisplayInfoType + TransactionsDisplayInfoType, + TransactionServerStatusesEnum } from 'types'; export interface ToastDataState { @@ -21,7 +22,7 @@ export interface ToastDataState { } interface GetToastsOptionsDataPropsType { - status?: TransactionBatchStatusesEnum; + status?: TransactionBatchStatusesEnum | TransactionServerStatusesEnum; toastId: string; classes?: Record< 'success' | 'warning' | 'danger' | string, diff --git a/src/UI/TransactionsToastList/components/TransactionToastGuard.tsx b/src/UI/TransactionsToastList/components/TransactionToastGuard.tsx index 9aaba94fe..41ea85f68 100644 --- a/src/UI/TransactionsToastList/components/TransactionToastGuard.tsx +++ b/src/UI/TransactionsToastList/components/TransactionToastGuard.tsx @@ -29,6 +29,7 @@ export const TransactionToastGuard = ({ const invalidCurrentTx = currentTx?.transactions == null || currentTx?.status == null; + if (invalidCurrentTx) { return null; } diff --git a/src/types/toasts.types.ts b/src/types/toasts.types.ts index ffca78481..5f249e653 100644 --- a/src/types/toasts.types.ts +++ b/src/types/toasts.types.ts @@ -1,5 +1,6 @@ import { IconDefinition } from '@fortawesome/free-solid-svg-icons'; import { ServerTransactionType } from './serverTransactions.types'; +import { SignedTransactionType } from './transactions.types'; interface SharedCustomToast { toastId: string; @@ -60,7 +61,12 @@ export type CustomToastType = | TransactionIconToastType; export interface TransactionToastType { - toastId: string; + duration?: number; + icon?: IconDefinition; + iconClassName?: string; startTimestamp: number; + title?: string; + toastId: string; + transaction?: SignedTransactionType; type: string; } From 1fb6dfcc85814b93edb31b462f5baa1402b64140 Mon Sep 17 00:00:00 2001 From: "razvan.tomegea" Date: Fri, 8 Nov 2024 14:12:36 +0200 Subject: [PATCH 2/6] Refactor --- src/hooks/login/useLoginService.ts | 2 + .../useSignMultipleTransactions.tsx | 11 ++++- .../useSignTransactionsWithDevice.tsx | 3 +- src/services/nativeAuth/nativeAuth.ts | 41 +++++++++++-------- src/utils/account/signMessage.ts | 2 +- 5 files changed, 39 insertions(+), 20 deletions(-) diff --git a/src/hooks/login/useLoginService.ts b/src/hooks/login/useLoginService.ts index 254504ec9..3d29504d8 100644 --- a/src/hooks/login/useLoginService.ts +++ b/src/hooks/login/useLoginService.ts @@ -96,6 +96,7 @@ export const useLoginService = (config?: OnProviderLoginType['nativeAuth']) => { ...(apiAddress ? { nativeAuthConfig: configuration } : {}) }) ); + return nativeAuthToken; }; @@ -119,6 +120,7 @@ export const useLoginService = (config?: OnProviderLoginType['nativeAuth']) => { }); tokenRef.current = loginToken; + if (!loginToken) { return; } diff --git a/src/hooks/transactions/useSignMultipleTransactions.tsx b/src/hooks/transactions/useSignMultipleTransactions.tsx index 484c1f743..2a488b3d3 100644 --- a/src/hooks/transactions/useSignMultipleTransactions.tsx +++ b/src/hooks/transactions/useSignMultipleTransactions.tsx @@ -183,6 +183,7 @@ export const useSignMultipleTransactions = ({ setWaitingForDevice(isLedger); let signedTx: Nullable; + try { signedTx = await onSignTransaction(currentTransaction.transaction); } catch (err) { @@ -205,6 +206,7 @@ export const useSignMultipleTransactions = ({ const newSignedTransactions = signedTransactions ? { ...signedTransactions, ...newSignedTx } : newSignedTx; + setSignedTransactions(newSignedTransactions); if (!isLastTransaction) { @@ -237,6 +239,7 @@ export const useSignMultipleTransactions = ({ if (currentTransaction == null) { return; } + const signature = currentTransaction.transaction.getSignature(); if (signature.toString('hex') && !isLastTransaction) { @@ -245,7 +248,8 @@ export const useSignMultipleTransactions = ({ } await sign(); - } catch { + } catch (e) { + console.error('Error during signing transaction'); // the only way to check if tx has signature is with try catch await sign(); } @@ -274,15 +278,18 @@ export const useSignMultipleTransactions = ({ setCurrentStep((exising) => exising + 1); return; } + await signTx(); }; const onNext = () => { setCurrentStep((current) => { const nextStep = current + 1; + if (nextStep > allTransactions?.length) { return current; } + return nextStep; }); }; @@ -290,9 +297,11 @@ export const useSignMultipleTransactions = ({ const onPrev = () => { setCurrentStep((current) => { const nextStep = current - 1; + if (nextStep < 0) { return current; } + return nextStep; }); }; diff --git a/src/hooks/transactions/useSignTransactionsWithDevice.tsx b/src/hooks/transactions/useSignTransactionsWithDevice.tsx index 27c6000f3..00909ea72 100644 --- a/src/hooks/transactions/useSignTransactionsWithDevice.tsx +++ b/src/hooks/transactions/useSignTransactionsWithDevice.tsx @@ -160,7 +160,8 @@ export function useSignTransactionsWithDevice( if (!transaction) { return null; } - return await connectedProvider.signTransaction(transaction); + + return connectedProvider.signTransaction(transaction); } const signMultipleTxReturnValues = useSignMultipleTransactions({ diff --git a/src/services/nativeAuth/nativeAuth.ts b/src/services/nativeAuth/nativeAuth.ts index 777a94a67..ca61f650e 100644 --- a/src/services/nativeAuth/nativeAuth.ts +++ b/src/services/nativeAuth/nativeAuth.ts @@ -42,25 +42,32 @@ export const nativeAuth = (config?: NativeAuthConfigType) => { const getBlockHash = (): Promise => nativeAuthClient.getCurrentBlockHash(); - const response = - initProps?.latestBlockInfo ?? - (await getLatestBlockHash( - apiAddress, - blockHashShard, - getBlockHash, - initProps?.noCache - )); - const { hash, timestamp } = response; - const encodedExtraInfo = nativeAuthClient.encodeValue( - JSON.stringify({ - ...(initProps?.extraInfo ?? extraInfoFromConfig), - ...(timestamp ? { timestamp } : {}) - }) - ); - const encodedOrigin = nativeAuthClient.encodeValue(origin); + try { + const response = + initProps?.latestBlockInfo ?? + (await getLatestBlockHash( + apiAddress, + blockHashShard, + getBlockHash, + initProps?.noCache + )); - return `${encodedOrigin}.${hash}.${expirySeconds}.${encodedExtraInfo}`; + const { hash, timestamp } = response; + const encodedExtraInfo = nativeAuthClient.encodeValue( + JSON.stringify({ + ...(initProps?.extraInfo ?? extraInfoFromConfig), + ...(timestamp ? { timestamp } : {}) + }) + ); + + const encodedOrigin = nativeAuthClient.encodeValue(origin); + + return `${encodedOrigin}.${hash}.${expirySeconds}.${encodedExtraInfo}`; + } catch (err) { + console.error('Error getting native auth token: ', err); + return ''; + } }; const getToken = ({ diff --git a/src/utils/account/signMessage.ts b/src/utils/account/signMessage.ts index 520b18906..402cf4ee0 100644 --- a/src/utils/account/signMessage.ts +++ b/src/utils/account/signMessage.ts @@ -38,7 +38,7 @@ export const signMessage = async ({ ); } - return await provider.signMessage(signableMessage, { + return provider.signMessage(signableMessage, { callbackUrl: encodeURIComponent(callbackUrl) }); }; From 99e4c04f6887a9ced1a1887918587f311578c274 Mon Sep 17 00:00:00 2001 From: "razvan.tomegea" Date: Fri, 8 Nov 2024 20:44:23 +0200 Subject: [PATCH 3/6] Added transaction received toast --- .../TransactionDetails/TransactionDetails.tsx | 27 ++++++++++++++----- .../components/CustomToast/CustomToast.tsx | 15 ++++++----- .../hooks/useTransactionToast.ts | 9 ++++--- .../utils/getToastDataStateByStatus.ts | 23 ++++++++++++---- src/types/enums.types.ts | 1 + 5 files changed, 54 insertions(+), 21 deletions(-) diff --git a/src/UI/TransactionDetails/TransactionDetails.tsx b/src/UI/TransactionDetails/TransactionDetails.tsx index e1b82d604..e42050db5 100644 --- a/src/UI/TransactionDetails/TransactionDetails.tsx +++ b/src/UI/TransactionDetails/TransactionDetails.tsx @@ -1,6 +1,10 @@ -import React, { useMemo, ReactNode } from 'react'; +import React, { ReactNode, useMemo } from 'react'; import { withStyles, WithStylesImportType } from 'hocs/withStyles'; -import { SignedTransactionType } from 'types/index'; +import { useGetAccount } from 'hooks/account/useGetAccount'; +import { + SignedTransactionType, + TransactionServerStatusesEnum +} from 'types/index'; import { isServerTransactionPending } from 'utils/transactions/transactionStateByStatus'; import { TransactionDetailsBody, @@ -25,14 +29,20 @@ const TransactionDetailsComponent = ({ return null; } + const { address } = useGetAccount(); + const processedTransactionsStatus = useMemo(() => { const processedTransactions = transactions.filter( - (tx) => !isServerTransactionPending(tx?.status) + (tx) => + !isServerTransactionPending(TransactionServerStatusesEnum[tx?.status]) ).length; + const totalTransactions = transactions.length; if (totalTransactions === 1 && processedTransactions === 1) { - return isServerTransactionPending(transactions[0].status) + return isServerTransactionPending( + TransactionServerStatusesEnum[transactions[0].status] + ) ? 'Processing transaction' : 'Transaction processed'; } @@ -40,17 +50,22 @@ const TransactionDetailsComponent = ({ return `${processedTransactions} / ${totalTransactions} transactions processed`; }, [transactions]); + const hideProcessedTransactionsStatus = + transactions.length === 1 && transactions[0].sender !== address; + return ( <> {title &&
{title}
} -
{processedTransactionsStatus}
+ {!hideProcessedTransactionsStatus && ( +
{processedTransactionsStatus}
+ )} {transactions.map(({ hash, status }) => { const transactionDetailsBodyProps: TransactionDetailsBodyPropsType = { className, hash, - status, + status: TransactionServerStatusesEnum[status], isTimedOut }; diff --git a/src/UI/TransactionsToastList/components/CustomToast/CustomToast.tsx b/src/UI/TransactionsToastList/components/CustomToast/CustomToast.tsx index cc5aaa096..ceb89291a 100644 --- a/src/UI/TransactionsToastList/components/CustomToast/CustomToast.tsx +++ b/src/UI/TransactionsToastList/components/CustomToast/CustomToast.tsx @@ -1,9 +1,9 @@ import React from 'react'; +import { TransactionBatchStatusesEnum } from 'types'; +import { TransactionToast } from '../TransactionToast'; import { IconToast, SimpleToast, CustomComponentToast } from './components'; import { CustomToastPropsType } from './customToast.types'; import { useRemoveCustomToast } from './helpers'; -import { TransactionToast } from '../TransactionToast'; -import { TransactionToastType } from 'types/toasts.types'; export const CustomToast = (props: CustomToastPropsType) => { const { duration, onDelete } = props; @@ -13,14 +13,15 @@ export const CustomToast = (props: CustomToastPropsType) => { return ; } - const customToastProps = props as unknown as TransactionToastType; + if (props.transaction) { + const transaction = props.transaction as any; + const transactionHash = transaction.txHash || transaction.hash; - if (customToastProps.transaction) { return ( ); } diff --git a/src/UI/TransactionsToastList/components/TransactionToast/hooks/useTransactionToast.ts b/src/UI/TransactionsToastList/components/TransactionToast/hooks/useTransactionToast.ts index 3c8333738..f68fe87de 100644 --- a/src/UI/TransactionsToastList/components/TransactionToast/hooks/useTransactionToast.ts +++ b/src/UI/TransactionsToastList/components/TransactionToast/hooks/useTransactionToast.ts @@ -1,7 +1,7 @@ import { useEffect, useMemo, useRef } from 'react'; import { AVERAGE_TX_DURATION_MS, CROSS_SHARD_ROUNDS } from 'constants/index'; import { useStyles } from 'hocs/useStyles'; -import { useGetTransactionDisplayInfo } from 'hooks'; +import { useGetAccount, useGetTransactionDisplayInfo } from 'hooks'; import { useSelector } from 'reduxStore/DappProviderContext'; import { shardSelector } from 'reduxStore/selectors'; import { getUnixTimestamp } from 'utils/dateTime/getUnixTimestamp'; @@ -37,6 +37,7 @@ export const useTransactionToast = ({ const transactionDisplayInfo = useGetTransactionDisplayInfo(toastId); const accountShard = useSelector(shardSelector); + const { address } = useGetAccount(); const timeoutRef = useRef(); const areSameShardTransactions = useMemo( () => getAreTransactionsOnSameShard(transactions, accountShard), @@ -71,10 +72,12 @@ export const useTransactionToast = ({ const isCompleted = isFailed || isSuccess || isTimedOut; const toastDataState = getToastDataStateByStatus({ + address, + classes: styles ?? {}, + sender: transactions?.[0].sender || address, status, toastId, - transactionDisplayInfo, - classes: styles ?? {} + transactionDisplayInfo }); const handleDeleteToast = () => { diff --git a/src/UI/TransactionsToastList/components/TransactionToast/utils/getToastDataStateByStatus.ts b/src/UI/TransactionsToastList/components/TransactionToast/utils/getToastDataStateByStatus.ts index fb07d25f5..5597dd9f2 100644 --- a/src/UI/TransactionsToastList/components/TransactionToast/utils/getToastDataStateByStatus.ts +++ b/src/UI/TransactionsToastList/components/TransactionToast/utils/getToastDataStateByStatus.ts @@ -22,23 +22,27 @@ export interface ToastDataState { } interface GetToastsOptionsDataPropsType { - status?: TransactionBatchStatusesEnum | TransactionServerStatusesEnum; - toastId: string; + address: string; classes?: Record< 'success' | 'warning' | 'danger' | string, 'success' | 'warning' | 'danger' | string >; + sender: string; + status?: TransactionBatchStatusesEnum | TransactionServerStatusesEnum; + toastId: string; transactionDisplayInfo: TransactionsDisplayInfoType; } export const getToastDataStateByStatus = ({ - status, - toastId, + address, classes = { success: 'success', danger: 'danger', warning: 'warning' }, + sender, + status, + toastId, transactionDisplayInfo }: GetToastsOptionsDataPropsType) => { const successToastData: ToastDataState = { @@ -52,6 +56,15 @@ export const getToastDataStateByStatus = ({ iconClassName: classes.success }; + const receivedToastData: ToastDataState = { + id: toastId, + icon: faCheck, + expires: 30000, + hasCloseButton: true, + title: TransactionsDefaultTitles.received, + iconClassName: classes.success + }; + const pendingToastData: ToastDataState = { id: toastId, expires: false, @@ -97,7 +110,7 @@ export const getToastDataStateByStatus = ({ case TransactionBatchStatusesEnum.sent: return pendingToastData; case TransactionBatchStatusesEnum.success: - return successToastData; + return sender !== address ? receivedToastData : successToastData; case TransactionBatchStatusesEnum.cancelled: case TransactionBatchStatusesEnum.fail: return failToastData; diff --git a/src/types/enums.types.ts b/src/types/enums.types.ts index 64476be1f..7612d0d8c 100644 --- a/src/types/enums.types.ts +++ b/src/types/enums.types.ts @@ -79,6 +79,7 @@ export enum TransactionTypesEnum { export enum TransactionsDefaultTitles { success = 'Transaction successful', + received = 'Transaction received', failed = 'Transaction failed', pending = 'Processing transaction', timedOut = 'Transaction timed out', From 58767326b7a3419c01c8df85e0c84105c0044abc Mon Sep 17 00:00:00 2001 From: "razvan.tomegea" Date: Mon, 11 Nov 2024 09:42:17 +0200 Subject: [PATCH 4/6] CHANGELOG.md --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index b78f78d2d..46212678e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +- [Added ability to show transaction toast on demand](https://github.com/multiversx/mx-sdk-dapp/pull/1304) + ## [[v3.0.9](https://github.com/multiversx/mx-sdk-dapp/pull/1299)] - 2024-11-06 - [Fix clear initiated login](https://github.com/multiversx/mx-sdk-dapp/pull/1301) From da747c679ed2c8f864ea114f954a5cee53f856ac Mon Sep 17 00:00:00 2001 From: "razvan.tomegea" Date: Mon, 11 Nov 2024 10:06:57 +0200 Subject: [PATCH 5/6] Refactor --- .../components/CustomToast/CustomToast.tsx | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/src/UI/TransactionsToastList/components/CustomToast/CustomToast.tsx b/src/UI/TransactionsToastList/components/CustomToast/CustomToast.tsx index ceb89291a..52a74dfbe 100644 --- a/src/UI/TransactionsToastList/components/CustomToast/CustomToast.tsx +++ b/src/UI/TransactionsToastList/components/CustomToast/CustomToast.tsx @@ -1,5 +1,9 @@ import React from 'react'; -import { TransactionBatchStatusesEnum } from 'types'; +import { + ServerTransactionType, + SignedTransactionType, + TransactionBatchStatusesEnum +} from 'types'; import { TransactionToast } from '../TransactionToast'; import { IconToast, SimpleToast, CustomComponentToast } from './components'; import { CustomToastPropsType } from './customToast.types'; @@ -14,14 +18,17 @@ export const CustomToast = (props: CustomToastPropsType) => { } if (props.transaction) { - const transaction = props.transaction as any; - const transactionHash = transaction.txHash || transaction.hash; + const serverTransaction = props.transaction as ServerTransactionType; + const signedTransaction = + props.transaction as unknown as SignedTransactionType; + + const transactionHash = serverTransaction.txHash || signedTransaction.hash; return ( ); } From 198f0b925d92104b2ff2d9c2f6c066231447cbb1 Mon Sep 17 00:00:00 2001 From: "razvan.tomegea" Date: Mon, 11 Nov 2024 10:25:10 +0200 Subject: [PATCH 6/6] Refactor --- src/hooks/transactions/useSignTransactionsWithDevice.tsx | 6 +++++- src/utils/account/signMessage.ts | 4 +++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/hooks/transactions/useSignTransactionsWithDevice.tsx b/src/hooks/transactions/useSignTransactionsWithDevice.tsx index 00909ea72..80d3cb776 100644 --- a/src/hooks/transactions/useSignTransactionsWithDevice.tsx +++ b/src/hooks/transactions/useSignTransactionsWithDevice.tsx @@ -161,7 +161,11 @@ export function useSignTransactionsWithDevice( return null; } - return connectedProvider.signTransaction(transaction); + const signedTransaction = await connectedProvider.signTransaction( + transaction + ); + + return signedTransaction; } const signMultipleTxReturnValues = useSignMultipleTransactions({ diff --git a/src/utils/account/signMessage.ts b/src/utils/account/signMessage.ts index 402cf4ee0..342a5e6ff 100644 --- a/src/utils/account/signMessage.ts +++ b/src/utils/account/signMessage.ts @@ -38,7 +38,9 @@ export const signMessage = async ({ ); } - return provider.signMessage(signableMessage, { + const signedMessage = await provider.signMessage(signableMessage, { callbackUrl: encodeURIComponent(callbackUrl) }); + + return signedMessage; };