@dynamic-labs/sdk-react-core 0.17.27 → 0.17.29
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +14 -0
- package/package.cjs +1 -1
- package/package.js +1 -1
- package/package.json +8 -8
- package/src/lib/components/TransactionStatusLayout/TransactionStatusLayout.cjs +1 -1
- package/src/lib/components/TransactionStatusLayout/TransactionStatusLayout.js +1 -1
- package/src/lib/context/DynamicContext/DynamicContext.cjs +4 -4
- package/src/lib/context/DynamicContext/DynamicContext.d.ts +2 -2
- package/src/lib/context/DynamicContext/DynamicContext.js +4 -4
- package/src/lib/context/SocialRedirectContext/SocialRedirectContext.cjs +3 -3
- package/src/lib/context/SocialRedirectContext/SocialRedirectContext.js +3 -3
- package/src/lib/modals/TransactionConfirmationModal/TransactionConfirmationModal.cjs +10 -2
- package/src/lib/modals/TransactionConfirmationModal/TransactionConfirmationModal.js +10 -2
- package/src/lib/modals/TransactionConfirmationModal/TransactionConfirmationModal.types.d.ts +2 -0
- package/src/lib/utils/functions/index.d.ts +1 -0
- package/src/lib/utils/functions/isMagicConnector/index.d.ts +1 -0
- package/src/lib/utils/functions/isMagicConnector/isMagicConnector.cjs +10 -0
- package/src/lib/utils/functions/isMagicConnector/isMagicConnector.d.ts +2 -0
- package/src/lib/utils/functions/isMagicConnector/isMagicConnector.js +6 -0
- package/src/lib/utils/hooks/authenticationHooks/useConnectAndSign/useConnectAndSign.cjs +2 -2
- package/src/lib/utils/hooks/authenticationHooks/useConnectAndSign/useConnectAndSign.js +2 -2
- package/src/lib/utils/hooks/index.d.ts +2 -0
- package/src/lib/utils/hooks/useTransactionEstimatedGas/index.d.ts +1 -0
- package/src/lib/utils/hooks/useTransactionEstimatedGas/useTransactionEstimatedGas.cjs +42 -0
- package/src/lib/utils/hooks/useTransactionEstimatedGas/useTransactionEstimatedGas.d.ts +2 -0
- package/src/lib/utils/hooks/useTransactionEstimatedGas/useTransactionEstimatedGas.js +38 -0
- package/src/lib/utils/hooks/useTransactionWithGasPrice/index.d.ts +1 -0
- package/src/lib/utils/hooks/useTransactionWithGasPrice/useTransactionWithGasPrice.cjs +41 -0
- package/src/lib/utils/hooks/useTransactionWithGasPrice/useTransactionWithGasPrice.d.ts +32 -0
- package/src/lib/utils/hooks/useTransactionWithGasPrice/useTransactionWithGasPrice.js +37 -0
- package/src/lib/utils/hooks/useWalletUiUtils/useWalletUiUtils.cjs +20 -19
- package/src/lib/utils/hooks/useWalletUiUtils/useWalletUiUtils.d.ts +4 -1
- package/src/lib/utils/hooks/useWalletUiUtils/useWalletUiUtils.js +20 -19
- package/src/lib/utils/hooks/useWallets/useWallets.cjs +3 -3
- package/src/lib/utils/hooks/useWallets/useWallets.d.ts +3 -3
- package/src/lib/utils/hooks/useWallets/useWallets.js +3 -3
- package/src/lib/views/SendBalanceView/SendBalanceView.cjs +9 -16
- package/src/lib/views/SendBalanceView/SendBalanceView.js +9 -16
- package/src/lib/views/SendBalanceView/components/TransactionStage/TransactionStage.cjs +63 -0
- package/src/lib/views/SendBalanceView/components/TransactionStage/TransactionStage.d.ts +8 -0
- package/src/lib/views/SendBalanceView/components/TransactionStage/TransactionStage.js +59 -0
- package/src/lib/views/SendBalanceView/components/TransactionStage/index.d.ts +1 -0
- package/src/lib/views/SendBalanceView/components/index.d.ts +1 -0
- package/src/lib/views/TransactionConfirmationView/TransactionConfirmationView.cjs +2 -2
- package/src/lib/views/TransactionConfirmationView/TransactionConfirmationView.js +2 -2
- package/src/lib/views/TransactionConfirmationView/hooks/useTransactionData/useTransactionData.cjs +24 -17
- package/src/lib/views/TransactionConfirmationView/hooks/useTransactionData/useTransactionData.d.ts +4 -0
- package/src/lib/views/TransactionConfirmationView/hooks/useTransactionData/useTransactionData.js +25 -18
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { usePromise } from '../usePromise/usePromise.js';
|
|
2
|
+
|
|
3
|
+
const increaseGasPrice = (gasPrice, increasePercentage) => {
|
|
4
|
+
const increaseFactor = 100 + increasePercentage;
|
|
5
|
+
return gasPrice.mul(increaseFactor).div(100);
|
|
6
|
+
};
|
|
7
|
+
/**
|
|
8
|
+
* A React Hook that returns a transaction object with the gas price set to the current gas price from the provider.
|
|
9
|
+
* The gas price is increased by a certain percentage specified by the user. The hook also allows the user to enable
|
|
10
|
+
* or disable this functionality.
|
|
11
|
+
*
|
|
12
|
+
* @param {Object} props - The properties for the hook.
|
|
13
|
+
* @param {ethers.providers.Provider} props.provider - The provider to use for getting the current gas price.
|
|
14
|
+
* @param {ethers.utils.Deferrable<ethers.providers.TransactionRequest>} props.transaction - The transaction object.
|
|
15
|
+
* @param {number} props.increasePercentage - The percentage by which to increase the current gas price.
|
|
16
|
+
* @param {boolean} [props.enabled=true] - A flag to enable or disable the gas price increase functionality.
|
|
17
|
+
*
|
|
18
|
+
* @returns {ethers.utils.Deferrable<ethers.providers.TransactionRequest>} A new transaction object with the gas price.
|
|
19
|
+
* If the `enabled` flag is set to false, or if the gas price is not available, or if the transaction already has a
|
|
20
|
+
* gas price set, the original transaction object is returned.
|
|
21
|
+
*
|
|
22
|
+
* @example
|
|
23
|
+
* const updatedTransaction = useTransactionWithGasPrice({
|
|
24
|
+
* provider: myProvider,
|
|
25
|
+
* transaction: myTransaction,
|
|
26
|
+
* increasePercentage: 10,
|
|
27
|
+
* enabled: true,
|
|
28
|
+
* });
|
|
29
|
+
*/
|
|
30
|
+
const useTransactionWithGasPrice = ({ increasePercentage = 0, provider, transaction, enabled = true, }) => {
|
|
31
|
+
const { data: gasPrice } = usePromise(() => provider.getGasPrice(), [transaction, provider]);
|
|
32
|
+
if (!enabled || !gasPrice || Boolean(transaction.gasPrice))
|
|
33
|
+
return transaction;
|
|
34
|
+
return Object.assign(Object.assign({}, transaction), { gasPrice: increaseGasPrice(gasPrice, increasePercentage) });
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
export { useTransactionWithGasPrice };
|
|
@@ -58,27 +58,28 @@ const useWalletUiUtils = ({ appLogoUrl, appName, getAppOrigin, }) => {
|
|
|
58
58
|
}
|
|
59
59
|
return true;
|
|
60
60
|
}, [confirmationStateRef]);
|
|
61
|
-
const
|
|
62
|
-
if (!shouldConfirmAction()) {
|
|
63
|
-
return handler(message);
|
|
64
|
-
}
|
|
65
|
-
return openSignMessage((resolve, reject) => (jsxRuntime.jsx(SignMessageConfirmationModal.SignMessageConfirmationModal, { appLogoUrl: appLogoUrl, appName: appName, appOrigin: getAppOrigin(), message: message, handler: handler, onSignMessage: resolve, onReject: reject })));
|
|
66
|
-
}, [appLogoUrl, appName, getAppOrigin, openSignMessage, shouldConfirmAction]);
|
|
67
|
-
const sendTransaction = React.useCallback(({ transaction, handler, provider }) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
68
|
-
if (!shouldConfirmAction()) {
|
|
69
|
-
return handler(transaction);
|
|
70
|
-
}
|
|
71
|
-
return openSendTransaction((resolve, reject) => (jsxRuntime.jsx(TransactionConfirmationModal.TransactionConfirmationModal, { title: 'Send Transaction', transaction: transaction, handler: handler, onTransactionResponseSuccess: resolve, onReject: reject, provider: provider })));
|
|
72
|
-
}), [openSendTransaction, shouldConfirmAction]);
|
|
73
|
-
const disabledConfirmationOnce = React.useCallback(() => {
|
|
61
|
+
const disableConfirmationOnce = React.useCallback(() => {
|
|
74
62
|
confirmationStateRef.current = 'disabled';
|
|
75
63
|
}, []);
|
|
76
|
-
const
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
64
|
+
const createWalletUiUtils = React.useCallback((walletConnector) => ({
|
|
65
|
+
sendTransaction: ({ transaction, handler, provider }) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
66
|
+
if (!shouldConfirmAction()) {
|
|
67
|
+
return handler(transaction);
|
|
68
|
+
}
|
|
69
|
+
return openSendTransaction((resolve, reject) => (jsxRuntime.jsx(TransactionConfirmationModal.TransactionConfirmationModal, { title: 'Send Transaction', transaction: transaction, handler: handler, onTransactionResponseSuccess: resolve, onReject: reject, provider: provider, walletConnector: walletConnector })));
|
|
70
|
+
}),
|
|
71
|
+
signMessage: ({ message, handler }) => {
|
|
72
|
+
if (!shouldConfirmAction()) {
|
|
73
|
+
return handler(message);
|
|
74
|
+
}
|
|
75
|
+
return openSignMessage((resolve, reject) => (jsxRuntime.jsx(SignMessageConfirmationModal.SignMessageConfirmationModal, { appLogoUrl: appLogoUrl, appName: appName, appOrigin: getAppOrigin(), message: message, handler: handler, onSignMessage: resolve, onReject: reject })));
|
|
76
|
+
},
|
|
77
|
+
}), [shouldConfirmAction]);
|
|
78
|
+
return React.useMemo(() => [
|
|
79
|
+
modal || sendTransactionModal,
|
|
80
|
+
createWalletUiUtils,
|
|
81
|
+
{ disableConfirmationOnce },
|
|
82
|
+
], [modal, sendTransactionModal, createWalletUiUtils, disableConfirmationOnce]);
|
|
82
83
|
};
|
|
83
84
|
|
|
84
85
|
exports.useWalletUiUtils = useWalletUiUtils;
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
2
|
import { WalletUiUtils } from '@dynamic-labs/types';
|
|
3
|
+
import { WalletConnector } from '@dynamic-labs/wallet-connector-core';
|
|
3
4
|
import { WalletUiUtilsHookProps } from './useWalletUiUtils.types';
|
|
4
|
-
export declare const useWalletUiUtils: ({ appLogoUrl, appName, getAppOrigin, }: WalletUiUtilsHookProps) => [ReactNode
|
|
5
|
+
export declare const useWalletUiUtils: ({ appLogoUrl, appName, getAppOrigin, }: WalletUiUtilsHookProps) => [ReactNode, (connector: WalletConnector) => WalletUiUtils, {
|
|
6
|
+
disableConfirmationOnce: () => void;
|
|
7
|
+
}];
|
|
@@ -54,27 +54,28 @@ const useWalletUiUtils = ({ appLogoUrl, appName, getAppOrigin, }) => {
|
|
|
54
54
|
}
|
|
55
55
|
return true;
|
|
56
56
|
}, [confirmationStateRef]);
|
|
57
|
-
const
|
|
58
|
-
if (!shouldConfirmAction()) {
|
|
59
|
-
return handler(message);
|
|
60
|
-
}
|
|
61
|
-
return openSignMessage((resolve, reject) => (jsx(SignMessageConfirmationModal, { appLogoUrl: appLogoUrl, appName: appName, appOrigin: getAppOrigin(), message: message, handler: handler, onSignMessage: resolve, onReject: reject })));
|
|
62
|
-
}, [appLogoUrl, appName, getAppOrigin, openSignMessage, shouldConfirmAction]);
|
|
63
|
-
const sendTransaction = useCallback(({ transaction, handler, provider }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
64
|
-
if (!shouldConfirmAction()) {
|
|
65
|
-
return handler(transaction);
|
|
66
|
-
}
|
|
67
|
-
return openSendTransaction((resolve, reject) => (jsx(TransactionConfirmationModal, { title: 'Send Transaction', transaction: transaction, handler: handler, onTransactionResponseSuccess: resolve, onReject: reject, provider: provider })));
|
|
68
|
-
}), [openSendTransaction, shouldConfirmAction]);
|
|
69
|
-
const disabledConfirmationOnce = useCallback(() => {
|
|
57
|
+
const disableConfirmationOnce = useCallback(() => {
|
|
70
58
|
confirmationStateRef.current = 'disabled';
|
|
71
59
|
}, []);
|
|
72
|
-
const
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
60
|
+
const createWalletUiUtils = useCallback((walletConnector) => ({
|
|
61
|
+
sendTransaction: ({ transaction, handler, provider }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
62
|
+
if (!shouldConfirmAction()) {
|
|
63
|
+
return handler(transaction);
|
|
64
|
+
}
|
|
65
|
+
return openSendTransaction((resolve, reject) => (jsx(TransactionConfirmationModal, { title: 'Send Transaction', transaction: transaction, handler: handler, onTransactionResponseSuccess: resolve, onReject: reject, provider: provider, walletConnector: walletConnector })));
|
|
66
|
+
}),
|
|
67
|
+
signMessage: ({ message, handler }) => {
|
|
68
|
+
if (!shouldConfirmAction()) {
|
|
69
|
+
return handler(message);
|
|
70
|
+
}
|
|
71
|
+
return openSignMessage((resolve, reject) => (jsx(SignMessageConfirmationModal, { appLogoUrl: appLogoUrl, appName: appName, appOrigin: getAppOrigin(), message: message, handler: handler, onSignMessage: resolve, onReject: reject })));
|
|
72
|
+
},
|
|
73
|
+
}), [shouldConfirmAction]);
|
|
74
|
+
return useMemo(() => [
|
|
75
|
+
modal || sendTransactionModal,
|
|
76
|
+
createWalletUiUtils,
|
|
77
|
+
{ disableConfirmationOnce },
|
|
78
|
+
], [modal, sendTransactionModal, createWalletUiUtils, disableConfirmationOnce]);
|
|
78
79
|
};
|
|
79
80
|
|
|
80
81
|
export { useWalletUiUtils };
|
|
@@ -5,31 +5,31 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
5
5
|
var React = require('react');
|
|
6
6
|
var data = require('../../../views/WalletList/data.cjs');
|
|
7
7
|
|
|
8
|
-
const useWallets = ({ projectSettings, appLogoUrl, appName, flowNetwork, networkConfigurations, walletConnectV1Bridge,
|
|
8
|
+
const useWallets = ({ projectSettings, appLogoUrl, appName, flowNetwork, networkConfigurations, walletConnectV1Bridge, createWalletUiUtils, walletConnectorsProp, }) => {
|
|
9
9
|
const wallets = React.useMemo(() => {
|
|
10
10
|
if (!projectSettings)
|
|
11
11
|
return [];
|
|
12
12
|
const installedWallets = data.getInstalledWallets(projectSettings, {
|
|
13
13
|
appLogoUrl,
|
|
14
14
|
appName,
|
|
15
|
+
createWalletUiUtils,
|
|
15
16
|
customerApiProviders: projectSettings.providers || [],
|
|
16
17
|
flowNetwork,
|
|
17
18
|
networkConfigurations,
|
|
18
19
|
skipMemo: true,
|
|
19
20
|
walletConnectV1Bridge,
|
|
20
21
|
walletConnectorsProp: walletConnectorsProp !== null && walletConnectorsProp !== void 0 ? walletConnectorsProp : [],
|
|
21
|
-
walletUiUtils,
|
|
22
22
|
});
|
|
23
23
|
const notInstalledWallets = data.getNotInstalledWallets(projectSettings, {
|
|
24
24
|
appLogoUrl,
|
|
25
25
|
appName,
|
|
26
|
+
createWalletUiUtils,
|
|
26
27
|
customerApiProviders: projectSettings.providers || [],
|
|
27
28
|
flowNetwork,
|
|
28
29
|
networkConfigurations,
|
|
29
30
|
skipMemo: true,
|
|
30
31
|
walletConnectV1Bridge,
|
|
31
32
|
walletConnectorsProp: walletConnectorsProp !== null && walletConnectorsProp !== void 0 ? walletConnectorsProp : [],
|
|
32
|
-
walletUiUtils,
|
|
33
33
|
});
|
|
34
34
|
return [...installedWallets, ...notInstalledWallets];
|
|
35
35
|
// Cannot include walletUiUtils in the dependency array because it will cause an infinite loop
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ProjectSettings } from '@dynamic-labs/sdk-api';
|
|
2
2
|
import { NetworkConfigurationMap, WalletUiUtils } from '@dynamic-labs/types';
|
|
3
|
-
import { WalletConnectorsMethod } from '@dynamic-labs/wallet-connector-core';
|
|
3
|
+
import { WalletConnector, WalletConnectorsMethod } from '@dynamic-labs/wallet-connector-core';
|
|
4
4
|
type Props = {
|
|
5
5
|
appLogoUrl?: string;
|
|
6
6
|
appName?: string;
|
|
@@ -9,9 +9,9 @@ type Props = {
|
|
|
9
9
|
projectSettings: ProjectSettings | undefined;
|
|
10
10
|
walletConnectV1Bridge?: string;
|
|
11
11
|
walletConnectorsProp?: WalletConnectorsMethod[];
|
|
12
|
-
|
|
12
|
+
createWalletUiUtils: (connector: WalletConnector) => WalletUiUtils;
|
|
13
13
|
};
|
|
14
|
-
export declare const useWallets: ({ projectSettings, appLogoUrl, appName, flowNetwork, networkConfigurations, walletConnectV1Bridge,
|
|
14
|
+
export declare const useWallets: ({ projectSettings, appLogoUrl, appName, flowNetwork, networkConfigurations, walletConnectV1Bridge, createWalletUiUtils, walletConnectorsProp, }: Props) => {
|
|
15
15
|
wallets: import("../../../shared").WalletOption[];
|
|
16
16
|
};
|
|
17
17
|
export {};
|
|
@@ -1,31 +1,31 @@
|
|
|
1
1
|
import { useMemo } from 'react';
|
|
2
2
|
import { getInstalledWallets, getNotInstalledWallets } from '../../../views/WalletList/data.js';
|
|
3
3
|
|
|
4
|
-
const useWallets = ({ projectSettings, appLogoUrl, appName, flowNetwork, networkConfigurations, walletConnectV1Bridge,
|
|
4
|
+
const useWallets = ({ projectSettings, appLogoUrl, appName, flowNetwork, networkConfigurations, walletConnectV1Bridge, createWalletUiUtils, walletConnectorsProp, }) => {
|
|
5
5
|
const wallets = useMemo(() => {
|
|
6
6
|
if (!projectSettings)
|
|
7
7
|
return [];
|
|
8
8
|
const installedWallets = getInstalledWallets(projectSettings, {
|
|
9
9
|
appLogoUrl,
|
|
10
10
|
appName,
|
|
11
|
+
createWalletUiUtils,
|
|
11
12
|
customerApiProviders: projectSettings.providers || [],
|
|
12
13
|
flowNetwork,
|
|
13
14
|
networkConfigurations,
|
|
14
15
|
skipMemo: true,
|
|
15
16
|
walletConnectV1Bridge,
|
|
16
17
|
walletConnectorsProp: walletConnectorsProp !== null && walletConnectorsProp !== void 0 ? walletConnectorsProp : [],
|
|
17
|
-
walletUiUtils,
|
|
18
18
|
});
|
|
19
19
|
const notInstalledWallets = getNotInstalledWallets(projectSettings, {
|
|
20
20
|
appLogoUrl,
|
|
21
21
|
appName,
|
|
22
|
+
createWalletUiUtils,
|
|
22
23
|
customerApiProviders: projectSettings.providers || [],
|
|
23
24
|
flowNetwork,
|
|
24
25
|
networkConfigurations,
|
|
25
26
|
skipMemo: true,
|
|
26
27
|
walletConnectV1Bridge,
|
|
27
28
|
walletConnectorsProp: walletConnectorsProp !== null && walletConnectorsProp !== void 0 ? walletConnectorsProp : [],
|
|
28
|
-
walletUiUtils,
|
|
29
29
|
});
|
|
30
30
|
return [...installedWallets, ...notInstalledWallets];
|
|
31
31
|
// Cannot include walletUiUtils in the dependency array because it will cause an infinite loop
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var _tslib = require('../../../../_virtual/_tslib.cjs');
|
|
6
5
|
var jsxRuntime = require('react/jsx-runtime');
|
|
7
6
|
var React = require('react');
|
|
8
7
|
var ethers = require('ethers');
|
|
@@ -39,9 +38,9 @@ require('../../components/Popper/Popper/Popper.cjs');
|
|
|
39
38
|
require('../../components/Popper/PopperContext/PopperContext.cjs');
|
|
40
39
|
var SendBalancePageLayout = require('../../components/SendBalancePageLayout/SendBalancePageLayout.cjs');
|
|
41
40
|
require('../../components/MenuList/Dropdown/Dropdown.cjs');
|
|
42
|
-
var TransactionConfirmationView = require('../TransactionConfirmationView/TransactionConfirmationView.cjs');
|
|
43
|
-
var TransactionStatusLayout = require('../../components/TransactionStatusLayout/TransactionStatusLayout.cjs');
|
|
44
41
|
var useFetchCurrency = require('../../widgets/DynamicWidget/hooks/useFetchCurrency/useFetchCurrency.cjs');
|
|
42
|
+
var TransactionStatusLayout = require('../../components/TransactionStatusLayout/TransactionStatusLayout.cjs');
|
|
43
|
+
var TransactionStage = require('./components/TransactionStage/TransactionStage.cjs');
|
|
45
44
|
require('../../context/MockContext/MockContext.cjs');
|
|
46
45
|
require('../../context/CaptchaContext/CaptchaContext.cjs');
|
|
47
46
|
var usePromise = require('../../utils/hooks/usePromise/usePromise.cjs');
|
|
@@ -49,18 +48,17 @@ require('../../utils/hooks/useUserUpdateRequest/useUserUpdateRequest.cjs');
|
|
|
49
48
|
|
|
50
49
|
const SendBalanceView = ({ initialRecipientAddress = '', initialValue, onClickBack, onClickClose, onError, onSuccess, onDone, displayPoweredByDynamicFooter = false, }) => {
|
|
51
50
|
const [stage, setStage] = React.useState('form');
|
|
52
|
-
const { primaryWallet,
|
|
51
|
+
const { primaryWallet, network } = useInternalDynamicContext.useInternalDynamicContext();
|
|
53
52
|
const [value, setValue] = React.useState(initialValue !== null && initialValue !== void 0 ? initialValue : null);
|
|
54
53
|
const [recipientAddress, setRecipientAddress] = React.useState(initialRecipientAddress);
|
|
55
54
|
const transactionRef = React.useRef(null);
|
|
56
55
|
if (!primaryWallet) {
|
|
57
56
|
throw new utils.DynamicError('Primary wallet is not available, send balance cannot be displayed');
|
|
58
57
|
}
|
|
59
|
-
const
|
|
60
|
-
const { data:
|
|
61
|
-
const
|
|
62
|
-
|
|
63
|
-
[];
|
|
58
|
+
const walletConnector = primaryWallet.connector;
|
|
59
|
+
const { data: balance } = usePromise.usePromise(() => walletConnector.getBalance(), [walletConnector]);
|
|
60
|
+
const { data: provider } = usePromise.usePromise(() => walletConnector.getWeb3Provider(), [walletConnector]);
|
|
61
|
+
const evmNetworks = (walletConnector && walletConnector.evmNetworks) || [];
|
|
64
62
|
const evmNetwork = evmNetworks.find((evmNetwork) => evmNetwork.chainId === network);
|
|
65
63
|
const networkIcon = evmNetwork && (jsxRuntime.jsx("img", { src: evmNetwork === null || evmNetwork === void 0 ? void 0 : evmNetwork.iconUrls[0], alt: `${evmNetwork === null || evmNetwork === void 0 ? void 0 : evmNetwork.name} icon` }));
|
|
66
64
|
const networkName = (evmNetwork === null || evmNetwork === void 0 ? void 0 : evmNetwork.vanityName) || (evmNetwork === null || evmNetwork === void 0 ? void 0 : evmNetwork.name);
|
|
@@ -85,16 +83,11 @@ const SendBalanceView = ({ initialRecipientAddress = '', initialValue, onClickBa
|
|
|
85
83
|
to: recipientAddress,
|
|
86
84
|
value,
|
|
87
85
|
};
|
|
88
|
-
return (jsxRuntime.jsx(
|
|
86
|
+
return (jsxRuntime.jsx(TransactionStage.TransactionStage, { walletConnector: walletConnector, provider: provider, transaction: transaction, title: 'Confirm transaction', onClickBack: () => setStage('form'), onError: onError, displayPoweredByDynamicFooter: displayPoweredByDynamicFooter, onSuccess: (transaction) => {
|
|
89
87
|
transactionRef.current = transaction;
|
|
90
88
|
setStage('success');
|
|
91
89
|
onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess(transactionRef.current);
|
|
92
|
-
}
|
|
93
|
-
walletUiUtils.disabledConfirmationOnce();
|
|
94
|
-
const signer = provider.getSigner();
|
|
95
|
-
const sentTransaction = yield signer.sendTransaction(transaction);
|
|
96
|
-
return sentTransaction;
|
|
97
|
-
}) }));
|
|
90
|
+
} }));
|
|
98
91
|
};
|
|
99
92
|
const buildSuccessState = () => {
|
|
100
93
|
var _a;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { __awaiter } from '../../../../_virtual/_tslib.js';
|
|
2
1
|
import { jsx } from 'react/jsx-runtime';
|
|
3
2
|
import { useState, useRef } from 'react';
|
|
4
3
|
import { utils } from 'ethers';
|
|
@@ -35,9 +34,9 @@ import '../../components/Popper/Popper/Popper.js';
|
|
|
35
34
|
import '../../components/Popper/PopperContext/PopperContext.js';
|
|
36
35
|
import { SendBalancePageLayout } from '../../components/SendBalancePageLayout/SendBalancePageLayout.js';
|
|
37
36
|
import '../../components/MenuList/Dropdown/Dropdown.js';
|
|
38
|
-
import { TransactionConfirmationView } from '../TransactionConfirmationView/TransactionConfirmationView.js';
|
|
39
|
-
import { TransactionStatusLayout } from '../../components/TransactionStatusLayout/TransactionStatusLayout.js';
|
|
40
37
|
import { useFetchCurrency } from '../../widgets/DynamicWidget/hooks/useFetchCurrency/useFetchCurrency.js';
|
|
38
|
+
import { TransactionStatusLayout } from '../../components/TransactionStatusLayout/TransactionStatusLayout.js';
|
|
39
|
+
import { TransactionStage } from './components/TransactionStage/TransactionStage.js';
|
|
41
40
|
import '../../context/MockContext/MockContext.js';
|
|
42
41
|
import '../../context/CaptchaContext/CaptchaContext.js';
|
|
43
42
|
import { usePromise } from '../../utils/hooks/usePromise/usePromise.js';
|
|
@@ -45,18 +44,17 @@ import '../../utils/hooks/useUserUpdateRequest/useUserUpdateRequest.js';
|
|
|
45
44
|
|
|
46
45
|
const SendBalanceView = ({ initialRecipientAddress = '', initialValue, onClickBack, onClickClose, onError, onSuccess, onDone, displayPoweredByDynamicFooter = false, }) => {
|
|
47
46
|
const [stage, setStage] = useState('form');
|
|
48
|
-
const { primaryWallet,
|
|
47
|
+
const { primaryWallet, network } = useInternalDynamicContext();
|
|
49
48
|
const [value, setValue] = useState(initialValue !== null && initialValue !== void 0 ? initialValue : null);
|
|
50
49
|
const [recipientAddress, setRecipientAddress] = useState(initialRecipientAddress);
|
|
51
50
|
const transactionRef = useRef(null);
|
|
52
51
|
if (!primaryWallet) {
|
|
53
52
|
throw new DynamicError('Primary wallet is not available, send balance cannot be displayed');
|
|
54
53
|
}
|
|
55
|
-
const
|
|
56
|
-
const { data:
|
|
57
|
-
const
|
|
58
|
-
|
|
59
|
-
[];
|
|
54
|
+
const walletConnector = primaryWallet.connector;
|
|
55
|
+
const { data: balance } = usePromise(() => walletConnector.getBalance(), [walletConnector]);
|
|
56
|
+
const { data: provider } = usePromise(() => walletConnector.getWeb3Provider(), [walletConnector]);
|
|
57
|
+
const evmNetworks = (walletConnector && walletConnector.evmNetworks) || [];
|
|
60
58
|
const evmNetwork = evmNetworks.find((evmNetwork) => evmNetwork.chainId === network);
|
|
61
59
|
const networkIcon = evmNetwork && (jsx("img", { src: evmNetwork === null || evmNetwork === void 0 ? void 0 : evmNetwork.iconUrls[0], alt: `${evmNetwork === null || evmNetwork === void 0 ? void 0 : evmNetwork.name} icon` }));
|
|
62
60
|
const networkName = (evmNetwork === null || evmNetwork === void 0 ? void 0 : evmNetwork.vanityName) || (evmNetwork === null || evmNetwork === void 0 ? void 0 : evmNetwork.name);
|
|
@@ -81,16 +79,11 @@ const SendBalanceView = ({ initialRecipientAddress = '', initialValue, onClickBa
|
|
|
81
79
|
to: recipientAddress,
|
|
82
80
|
value,
|
|
83
81
|
};
|
|
84
|
-
return (jsx(
|
|
82
|
+
return (jsx(TransactionStage, { walletConnector: walletConnector, provider: provider, transaction: transaction, title: 'Confirm transaction', onClickBack: () => setStage('form'), onError: onError, displayPoweredByDynamicFooter: displayPoweredByDynamicFooter, onSuccess: (transaction) => {
|
|
85
83
|
transactionRef.current = transaction;
|
|
86
84
|
setStage('success');
|
|
87
85
|
onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess(transactionRef.current);
|
|
88
|
-
}
|
|
89
|
-
walletUiUtils.disabledConfirmationOnce();
|
|
90
|
-
const signer = provider.getSigner();
|
|
91
|
-
const sentTransaction = yield signer.sendTransaction(transaction);
|
|
92
|
-
return sentTransaction;
|
|
93
|
-
}) }));
|
|
86
|
+
} }));
|
|
94
87
|
};
|
|
95
88
|
const buildSuccessState = () => {
|
|
96
89
|
var _a;
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var _tslib = require('../../../../../../_virtual/_tslib.cjs');
|
|
6
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
7
|
+
require('react');
|
|
8
|
+
require('@dynamic-labs/utils');
|
|
9
|
+
require('@dynamic-labs/sdk-api');
|
|
10
|
+
require('../../../../config/ApiEndpoint.cjs');
|
|
11
|
+
require('../../../../shared/logger.cjs');
|
|
12
|
+
require('../../../../config/LSSuffix.cjs');
|
|
13
|
+
require('@dynamic-labs/iconic');
|
|
14
|
+
require('@dynamic-labs/wallet-connector-core');
|
|
15
|
+
require('../../../../context/ViewContext/ViewContext.cjs');
|
|
16
|
+
require('../../../../utils/constants/colors.cjs');
|
|
17
|
+
require('ethers');
|
|
18
|
+
require('../../../../shared/consts/index.cjs');
|
|
19
|
+
require('@dynamic-labs/multi-wallet');
|
|
20
|
+
var isMagicConnector = require('../../../../utils/functions/isMagicConnector/isMagicConnector.cjs');
|
|
21
|
+
require('@dynamic-labs/rpc-providers');
|
|
22
|
+
var useInternalDynamicContext = require('../../../../context/DynamicContext/useInternalDynamicContext.cjs');
|
|
23
|
+
require('../../../../context/ErrorContext/ErrorContext.cjs');
|
|
24
|
+
require('../../../../context/AccessDeniedContext/AccessDeniedContext.cjs');
|
|
25
|
+
require('react-dom');
|
|
26
|
+
require('../../../../components/ShadowDOM/ShadowDOM.cjs');
|
|
27
|
+
require('../../../../context/ThemeContext/ThemeContext.cjs');
|
|
28
|
+
require('react-focus-lock');
|
|
29
|
+
require('../../../../components/Transition/ZoomTransition/ZoomTransition.cjs');
|
|
30
|
+
require('../../../../components/Transition/SlideInUpTransition/SlideInUpTransition.cjs');
|
|
31
|
+
require('../../../../components/Transition/OpacityTransition/OpacityTransition.cjs');
|
|
32
|
+
require('../../../../components/IconButton/IconButton.cjs');
|
|
33
|
+
require('../../../../components/Alert/Alert.cjs');
|
|
34
|
+
require('@dynamic-labs/wallet-book');
|
|
35
|
+
require('../../../../components/Popper/Popper/Popper.cjs');
|
|
36
|
+
require('../../../../components/Popper/PopperContext/PopperContext.cjs');
|
|
37
|
+
require('formik');
|
|
38
|
+
require('yup');
|
|
39
|
+
require('../../../../components/MenuList/Dropdown/Dropdown.cjs');
|
|
40
|
+
var TransactionConfirmationView = require('../../../TransactionConfirmationView/TransactionConfirmationView.cjs');
|
|
41
|
+
require('../../../../context/MockContext/MockContext.cjs');
|
|
42
|
+
require('../../../../context/CaptchaContext/CaptchaContext.cjs');
|
|
43
|
+
require('../../../../utils/hooks/useUserUpdateRequest/useUserUpdateRequest.cjs');
|
|
44
|
+
var useTransactionWithGasPrice = require('../../../../utils/hooks/useTransactionWithGasPrice/useTransactionWithGasPrice.cjs');
|
|
45
|
+
|
|
46
|
+
const TransactionStage = (_a) => {
|
|
47
|
+
var { transaction, provider, walletConnector } = _a, rest = _tslib.__rest(_a, ["transaction", "provider", "walletConnector"]);
|
|
48
|
+
const { disableWalletConfirmationOnce } = useInternalDynamicContext.useInternalDynamicContext();
|
|
49
|
+
const transactionWithGasPrice = useTransactionWithGasPrice.useTransactionWithGasPrice({
|
|
50
|
+
enabled: isMagicConnector.isMagicConnector(walletConnector),
|
|
51
|
+
increasePercentage: 5,
|
|
52
|
+
provider,
|
|
53
|
+
transaction,
|
|
54
|
+
});
|
|
55
|
+
return (jsxRuntime.jsx(TransactionConfirmationView.TransactionConfirmationView, Object.assign({ provider: provider, transaction: transactionWithGasPrice, mutation: () => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
56
|
+
disableWalletConfirmationOnce();
|
|
57
|
+
const signer = provider.getSigner();
|
|
58
|
+
const sentTransaction = yield signer.sendTransaction(transactionWithGasPrice);
|
|
59
|
+
return sentTransaction;
|
|
60
|
+
}) }, rest)));
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
exports.TransactionStage = TransactionStage;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { FC } from 'react';
|
|
2
|
+
import { WalletConnector } from '@dynamic-labs/wallet-connector-core';
|
|
3
|
+
import { TransactionConfirmationViewProps } from '../../../TransactionConfirmationView';
|
|
4
|
+
type TransactionStageProps = Omit<TransactionConfirmationViewProps, 'mutation'> & {
|
|
5
|
+
walletConnector: WalletConnector;
|
|
6
|
+
};
|
|
7
|
+
export declare const TransactionStage: FC<TransactionStageProps>;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { __rest, __awaiter } from '../../../../../../_virtual/_tslib.js';
|
|
2
|
+
import { jsx } from 'react/jsx-runtime';
|
|
3
|
+
import 'react';
|
|
4
|
+
import '@dynamic-labs/utils';
|
|
5
|
+
import '@dynamic-labs/sdk-api';
|
|
6
|
+
import '../../../../config/ApiEndpoint.js';
|
|
7
|
+
import '../../../../shared/logger.js';
|
|
8
|
+
import '../../../../config/LSSuffix.js';
|
|
9
|
+
import '@dynamic-labs/iconic';
|
|
10
|
+
import '@dynamic-labs/wallet-connector-core';
|
|
11
|
+
import '../../../../context/ViewContext/ViewContext.js';
|
|
12
|
+
import '../../../../utils/constants/colors.js';
|
|
13
|
+
import 'ethers';
|
|
14
|
+
import '../../../../shared/consts/index.js';
|
|
15
|
+
import '@dynamic-labs/multi-wallet';
|
|
16
|
+
import { isMagicConnector } from '../../../../utils/functions/isMagicConnector/isMagicConnector.js';
|
|
17
|
+
import '@dynamic-labs/rpc-providers';
|
|
18
|
+
import { useInternalDynamicContext } from '../../../../context/DynamicContext/useInternalDynamicContext.js';
|
|
19
|
+
import '../../../../context/ErrorContext/ErrorContext.js';
|
|
20
|
+
import '../../../../context/AccessDeniedContext/AccessDeniedContext.js';
|
|
21
|
+
import 'react-dom';
|
|
22
|
+
import '../../../../components/ShadowDOM/ShadowDOM.js';
|
|
23
|
+
import '../../../../context/ThemeContext/ThemeContext.js';
|
|
24
|
+
import 'react-focus-lock';
|
|
25
|
+
import '../../../../components/Transition/ZoomTransition/ZoomTransition.js';
|
|
26
|
+
import '../../../../components/Transition/SlideInUpTransition/SlideInUpTransition.js';
|
|
27
|
+
import '../../../../components/Transition/OpacityTransition/OpacityTransition.js';
|
|
28
|
+
import '../../../../components/IconButton/IconButton.js';
|
|
29
|
+
import '../../../../components/Alert/Alert.js';
|
|
30
|
+
import '@dynamic-labs/wallet-book';
|
|
31
|
+
import '../../../../components/Popper/Popper/Popper.js';
|
|
32
|
+
import '../../../../components/Popper/PopperContext/PopperContext.js';
|
|
33
|
+
import 'formik';
|
|
34
|
+
import 'yup';
|
|
35
|
+
import '../../../../components/MenuList/Dropdown/Dropdown.js';
|
|
36
|
+
import { TransactionConfirmationView } from '../../../TransactionConfirmationView/TransactionConfirmationView.js';
|
|
37
|
+
import '../../../../context/MockContext/MockContext.js';
|
|
38
|
+
import '../../../../context/CaptchaContext/CaptchaContext.js';
|
|
39
|
+
import '../../../../utils/hooks/useUserUpdateRequest/useUserUpdateRequest.js';
|
|
40
|
+
import { useTransactionWithGasPrice } from '../../../../utils/hooks/useTransactionWithGasPrice/useTransactionWithGasPrice.js';
|
|
41
|
+
|
|
42
|
+
const TransactionStage = (_a) => {
|
|
43
|
+
var { transaction, provider, walletConnector } = _a, rest = __rest(_a, ["transaction", "provider", "walletConnector"]);
|
|
44
|
+
const { disableWalletConfirmationOnce } = useInternalDynamicContext();
|
|
45
|
+
const transactionWithGasPrice = useTransactionWithGasPrice({
|
|
46
|
+
enabled: isMagicConnector(walletConnector),
|
|
47
|
+
increasePercentage: 5,
|
|
48
|
+
provider,
|
|
49
|
+
transaction,
|
|
50
|
+
});
|
|
51
|
+
return (jsx(TransactionConfirmationView, Object.assign({ provider: provider, transaction: transactionWithGasPrice, mutation: () => __awaiter(void 0, void 0, void 0, function* () {
|
|
52
|
+
disableWalletConfirmationOnce();
|
|
53
|
+
const signer = provider.getSigner();
|
|
54
|
+
const sentTransaction = yield signer.sendTransaction(transactionWithGasPrice);
|
|
55
|
+
return sentTransaction;
|
|
56
|
+
}) }, rest)));
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
export { TransactionStage };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { TransactionStage } from './TransactionStage';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './TransactionStage';
|
|
@@ -65,7 +65,7 @@ const TransactionConfirmationView = ({ provider, transaction, mutation, onError,
|
|
|
65
65
|
onFailure: (error) => onError === null || onError === void 0 ? void 0 : onError(error),
|
|
66
66
|
onSuccess: (tx) => onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess(tx),
|
|
67
67
|
});
|
|
68
|
-
const { isLoading: isLoadingTransaction, isTransactionFromAddressLoading, isTransactionToAddressLoading, transactionFromAddress, transactionToAddress, isEffectiveValueLoading, transactionValue, gasEstimate, isGasPriceLoading, total, } = useTransactionData.useTransactionData({
|
|
68
|
+
const { isLoading: isLoadingTransaction, isTransactionFromAddressLoading, isTransactionToAddressLoading, transactionFromAddress, transactionToAddress, isEffectiveValueLoading, transactionGas, transactionValue, isGasLoading, gasEstimate, isGasPriceLoading, total, } = useTransactionData.useTransactionData({
|
|
69
69
|
provider,
|
|
70
70
|
transaction,
|
|
71
71
|
});
|
|
@@ -90,7 +90,7 @@ const TransactionConfirmationView = ({ provider, transaction, mutation, onError,
|
|
|
90
90
|
return `Insufficient funds due to gas price increase from estimate. Please add ${amountLeft} ${currencySymbol} to continue.`;
|
|
91
91
|
}, [currencySymbol, hasInsufficientFunds, missingFunds]);
|
|
92
92
|
return (jsxRuntime.jsxs(TransactionConfirmationPageLayout.TransactionConfirmationPageLayout, Object.assign({ onClickBack: onClickBack, onClickClose: onClickClose, title: title, appOrigin: appOrigin, appName: appName, appLogoUrl: appLogoUrl, isLoading: isLoading, onClickSend: () => send(), displayPoweredByDynamicFooter: displayPoweredByDynamicFooter, disableSendButton: isLoadingTransaction || hasInsufficientFunds, error: errorMessage, warningMessage: warningMessage }, { children: [jsxRuntime.jsx(TransactionRow.TransactionRow, Object.assign({ label: 'From (You)', isLoading: isTransactionFromAddressLoading, title: transactionFromAddress }, { children: shortenWalletAddress.shortenWalletAddress(transactionFromAddress, 4, 4) })), jsxRuntime.jsx(TransactionRow.TransactionRow, Object.assign({ label: 'To', isLoading: isTransactionToAddressLoading, title: transactionToAddress }, { children: transactionToAddress &&
|
|
93
|
-
shortenWalletAddress.shortenWalletAddress(transactionToAddress, 4, 4) })), jsxRuntime.jsx(TransactionRow.TransactionRow, Object.assign({ label: 'Amount', isLoading: isEffectiveValueLoading, isEmpty: !transactionValue, title: transactionValue && formatBigNumber.formatBigNumber(transactionValue), suffix: currencySymbol, icon: chainIcon, dataTestId: 'transaction-amount' }, { children: transactionValue ? formatBigNumber.formatBigNumber(transactionValue, 10) : 0 })), jsxRuntime.jsx(TransactionRow.TransactionRow, Object.assign({ label: 'Gas (
|
|
93
|
+
shortenWalletAddress.shortenWalletAddress(transactionToAddress, 4, 4) })), jsxRuntime.jsx(TransactionRow.TransactionRow, Object.assign({ label: 'Amount', isLoading: isEffectiveValueLoading, isEmpty: !transactionValue, title: transactionValue && formatBigNumber.formatBigNumber(transactionValue), suffix: currencySymbol, icon: chainIcon, dataTestId: 'transaction-amount' }, { children: transactionValue ? formatBigNumber.formatBigNumber(transactionValue, 10) : 0 })), transactionGas ? (jsxRuntime.jsx(TransactionRow.TransactionRow, Object.assign({ label: 'Gas', isEmpty: !transactionGas, isLoading: isGasLoading, title: transactionGas && formatBigNumber.formatBigNumber(transactionGas), suffix: transactionGas && currencySymbol, icon: transactionGas && chainIcon, dataTestId: 'transaction-gas-fee' }, { children: transactionGas ? formatBigNumber.formatBigNumber(transactionGas, 10) : 'N/A' }))) : (jsxRuntime.jsx(TransactionRow.TransactionRow, Object.assign({ label: 'Gas (estimate)', isEmpty: !gasEstimate, isLoading: isGasPriceLoading, title: gasEstimate && formatBigNumber.formatBigNumber(gasEstimate), suffix: gasEstimate && currencySymbol, icon: gasEstimate && chainIcon, dataTestId: 'transaction-estimated-gas-fee' }, { children: gasEstimate ? formatBigNumber.formatBigNumber(gasEstimate, 10) : 'N/A' }))), jsxRuntime.jsx(TransactionRow.TransactionRow, Object.assign({ label: 'Total', isEmpty: !total, title: total && formatBigNumber.formatBigNumber(total), suffix: total && currencySymbol, icon: total && chainIcon, dataTestId: 'transaction-total' }, { children: total ? formatBigNumber.formatBigNumber(total, 10) : 'N/A' }))] })));
|
|
94
94
|
};
|
|
95
95
|
|
|
96
96
|
exports.TransactionConfirmationView = TransactionConfirmationView;
|
|
@@ -61,7 +61,7 @@ const TransactionConfirmationView = ({ provider, transaction, mutation, onError,
|
|
|
61
61
|
onFailure: (error) => onError === null || onError === void 0 ? void 0 : onError(error),
|
|
62
62
|
onSuccess: (tx) => onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess(tx),
|
|
63
63
|
});
|
|
64
|
-
const { isLoading: isLoadingTransaction, isTransactionFromAddressLoading, isTransactionToAddressLoading, transactionFromAddress, transactionToAddress, isEffectiveValueLoading, transactionValue, gasEstimate, isGasPriceLoading, total, } = useTransactionData({
|
|
64
|
+
const { isLoading: isLoadingTransaction, isTransactionFromAddressLoading, isTransactionToAddressLoading, transactionFromAddress, transactionToAddress, isEffectiveValueLoading, transactionGas, transactionValue, isGasLoading, gasEstimate, isGasPriceLoading, total, } = useTransactionData({
|
|
65
65
|
provider,
|
|
66
66
|
transaction,
|
|
67
67
|
});
|
|
@@ -86,7 +86,7 @@ const TransactionConfirmationView = ({ provider, transaction, mutation, onError,
|
|
|
86
86
|
return `Insufficient funds due to gas price increase from estimate. Please add ${amountLeft} ${currencySymbol} to continue.`;
|
|
87
87
|
}, [currencySymbol, hasInsufficientFunds, missingFunds]);
|
|
88
88
|
return (jsxs(TransactionConfirmationPageLayout, Object.assign({ onClickBack: onClickBack, onClickClose: onClickClose, title: title, appOrigin: appOrigin, appName: appName, appLogoUrl: appLogoUrl, isLoading: isLoading, onClickSend: () => send(), displayPoweredByDynamicFooter: displayPoweredByDynamicFooter, disableSendButton: isLoadingTransaction || hasInsufficientFunds, error: errorMessage, warningMessage: warningMessage }, { children: [jsx(TransactionRow, Object.assign({ label: 'From (You)', isLoading: isTransactionFromAddressLoading, title: transactionFromAddress }, { children: shortenWalletAddress(transactionFromAddress, 4, 4) })), jsx(TransactionRow, Object.assign({ label: 'To', isLoading: isTransactionToAddressLoading, title: transactionToAddress }, { children: transactionToAddress &&
|
|
89
|
-
shortenWalletAddress(transactionToAddress, 4, 4) })), jsx(TransactionRow, Object.assign({ label: 'Amount', isLoading: isEffectiveValueLoading, isEmpty: !transactionValue, title: transactionValue && formatBigNumber(transactionValue), suffix: currencySymbol, icon: chainIcon, dataTestId: 'transaction-amount' }, { children: transactionValue ? formatBigNumber(transactionValue, 10) : 0 })), jsx(TransactionRow, Object.assign({ label: 'Gas (
|
|
89
|
+
shortenWalletAddress(transactionToAddress, 4, 4) })), jsx(TransactionRow, Object.assign({ label: 'Amount', isLoading: isEffectiveValueLoading, isEmpty: !transactionValue, title: transactionValue && formatBigNumber(transactionValue), suffix: currencySymbol, icon: chainIcon, dataTestId: 'transaction-amount' }, { children: transactionValue ? formatBigNumber(transactionValue, 10) : 0 })), transactionGas ? (jsx(TransactionRow, Object.assign({ label: 'Gas', isEmpty: !transactionGas, isLoading: isGasLoading, title: transactionGas && formatBigNumber(transactionGas), suffix: transactionGas && currencySymbol, icon: transactionGas && chainIcon, dataTestId: 'transaction-gas-fee' }, { children: transactionGas ? formatBigNumber(transactionGas, 10) : 'N/A' }))) : (jsx(TransactionRow, Object.assign({ label: 'Gas (estimate)', isEmpty: !gasEstimate, isLoading: isGasPriceLoading, title: gasEstimate && formatBigNumber(gasEstimate), suffix: gasEstimate && currencySymbol, icon: gasEstimate && chainIcon, dataTestId: 'transaction-estimated-gas-fee' }, { children: gasEstimate ? formatBigNumber(gasEstimate, 10) : 'N/A' }))), jsx(TransactionRow, Object.assign({ label: 'Total', isEmpty: !total, title: total && formatBigNumber(total), suffix: total && currencySymbol, icon: total && chainIcon, dataTestId: 'transaction-total' }, { children: total ? formatBigNumber(total, 10) : 'N/A' }))] })));
|
|
90
90
|
};
|
|
91
91
|
|
|
92
92
|
export { TransactionConfirmationView };
|