@dynamic-labs/sdk-react-core 0.18.0-beta.31 → 0.18.0
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 +36 -0
- package/package.cjs +2 -2
- package/package.js +2 -2
- package/package.json +9 -9
- package/src/lib/Main.cjs +5 -0
- package/src/lib/Main.js +5 -0
- package/src/lib/components/Button/Button.cjs +10 -7
- package/src/lib/components/Button/Button.js +10 -7
- package/src/lib/components/DynamicConnectButton/components/ConnectButton.cjs +1 -1
- package/src/lib/components/DynamicConnectButton/components/ConnectButton.js +1 -1
- package/src/lib/components/ErrorContainer/ErrorContainer.d.ts +1 -1
- package/src/lib/components/ListTile/ListTile.cjs +1 -1
- package/src/lib/components/ListTile/ListTile.js +1 -1
- package/src/lib/components/ListTile/ListTile.types.d.ts +1 -0
- package/src/lib/components/OTPVerificationView/OTPVerificationView.cjs +5 -3
- package/src/lib/components/OTPVerificationView/OTPVerificationView.d.ts +1 -0
- package/src/lib/components/OTPVerificationView/OTPVerificationView.js +5 -3
- package/src/lib/components/TransactionConfirmationPageLayout/TransactionConfirmationPageLayout.cjs +3 -1
- package/src/lib/components/TransactionConfirmationPageLayout/TransactionConfirmationPageLayout.js +3 -1
- package/src/lib/components/TransactionStatusLayout/TransactionStatusLayout.cjs +2 -2
- package/src/lib/components/TransactionStatusLayout/TransactionStatusLayout.js +2 -2
- package/src/lib/context/DynamicContext/DynamicContext.cjs +7 -2
- package/src/lib/context/DynamicContext/DynamicContext.js +8 -3
- package/src/lib/context/DynamicContext/hooks/useVerificationInProgress/useVerificationInProgress.cjs +13 -3
- package/src/lib/context/DynamicContext/hooks/useVerificationInProgress/useVerificationInProgress.js +13 -3
- package/src/lib/context/DynamicContext/types/index.d.ts +2 -2
- 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/styles/index.shadow.cjs +1 -1
- package/src/lib/styles/index.shadow.js +1 -1
- package/src/lib/utils/constants/errors.cjs +7 -0
- package/src/lib/utils/constants/errors.d.ts +1 -0
- package/src/lib/utils/constants/errors.js +3 -0
- package/src/lib/utils/constants/index.d.ts +1 -1
- package/src/lib/utils/constants/localStorage.cjs +3 -1
- package/src/lib/utils/constants/localStorage.d.ts +1 -0
- package/src/lib/utils/constants/localStorage.js +3 -2
- package/src/lib/utils/functions/getUserProfileFields/getUserProfileFields.cjs +14 -2
- package/src/lib/utils/functions/getUserProfileFields/getUserProfileFields.d.ts +3 -2
- package/src/lib/utils/functions/getUserProfileFields/getUserProfileFields.js +14 -2
- 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.d.ts +2 -1
- 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/multiWallet/useMultiWallet/useMultiWallet.cjs +19 -3
- package/src/lib/utils/hooks/multiWallet/useMultiWallet/useMultiWallet.d.ts +1 -2
- package/src/lib/utils/hooks/multiWallet/useMultiWallet/useMultiWallet.js +20 -4
- package/src/lib/utils/hooks/multiWallet/useSyncPrimaryWallet/useSyncPrimaryWallet.cjs +11 -9
- package/src/lib/utils/hooks/multiWallet/useSyncPrimaryWallet/useSyncPrimaryWallet.d.ts +1 -1
- package/src/lib/utils/hooks/multiWallet/useSyncPrimaryWallet/useSyncPrimaryWallet.js +11 -9
- package/src/lib/utils/hooks/useAuthLayoutChecks/useAuthLayoutChecks.cjs +1 -1
- package/src/lib/utils/hooks/useAuthLayoutChecks/useAuthLayoutChecks.js +1 -1
- package/src/lib/utils/hooks/useConnectWallet/useConnectWallet.cjs +2 -2
- package/src/lib/utils/hooks/useConnectWallet/useConnectWallet.d.ts +1 -1
- package/src/lib/utils/hooks/useConnectWallet/useConnectWallet.js +2 -2
- package/src/lib/utils/hooks/useFetchNetworkConfigurations/useFetchNetworkConfigurations.cjs +2 -7
- package/src/lib/utils/hooks/useFetchNetworkConfigurations/useFetchNetworkConfigurations.js +2 -7
- package/src/lib/utils/hooks/useFetchNetworkConfigurations/utils/index.d.ts +1 -0
- package/src/lib/utils/hooks/useFetchNetworkConfigurations/utils/mergeCustomerEvmNetworksWithServerNetworks/index.d.ts +1 -0
- package/src/lib/utils/hooks/useFetchNetworkConfigurations/utils/mergeCustomerEvmNetworksWithServerNetworks/mergeCustomerEvmNetworksWithServerNetworks.cjs +16 -0
- package/src/lib/utils/hooks/useFetchNetworkConfigurations/utils/mergeCustomerEvmNetworksWithServerNetworks/mergeCustomerEvmNetworksWithServerNetworks.d.ts +2 -0
- package/src/lib/utils/hooks/useFetchNetworkConfigurations/utils/mergeCustomerEvmNetworksWithServerNetworks/mergeCustomerEvmNetworksWithServerNetworks.js +12 -0
- package/src/lib/utils/hooks/useSocialAccounts/useSocialAccounts.cjs +22 -4
- package/src/lib/utils/hooks/useSocialAccounts/useSocialAccounts.js +22 -4
- package/src/lib/utils/hooks/useTransactionEstimatedGas/index.d.ts +1 -0
- package/src/lib/utils/hooks/useTransactionEstimatedGas/useTransactionEstimatedGas.cjs +61 -0
- package/src/lib/utils/hooks/useTransactionEstimatedGas/useTransactionEstimatedGas.d.ts +20 -0
- package/src/lib/utils/hooks/useTransactionEstimatedGas/useTransactionEstimatedGas.js +57 -0
- package/src/lib/utils/hooks/useTransactionWithGasPrice/index.d.ts +1 -0
- package/src/lib/utils/hooks/useTransactionWithGasPrice/useTransactionWithGasPrice.cjs +47 -0
- package/src/lib/utils/hooks/useTransactionWithGasPrice/useTransactionWithGasPrice.d.ts +32 -0
- package/src/lib/utils/hooks/useTransactionWithGasPrice/useTransactionWithGasPrice.js +43 -0
- package/src/lib/utils/hooks/useVerifyWallet/useVerifyWallet.cjs +1 -0
- package/src/lib/utils/hooks/useVerifyWallet/useVerifyWallet.js +1 -0
- package/src/lib/utils/hooks/useWalletEventListeners/useWalletEventListeners.d.ts +1 -1
- package/src/lib/utils/hooks/useWalletUiUtils/useWalletUiUtils.cjs +2 -2
- package/src/lib/utils/hooks/useWalletUiUtils/useWalletUiUtils.d.ts +5 -1
- package/src/lib/utils/hooks/useWalletUiUtils/useWalletUiUtils.js +2 -2
- package/src/lib/utils/hooks/useWallets/useWallets.d.ts +2 -2
- package/src/lib/views/CollectUserDataView/UserDataFields/index.cjs +4 -0
- package/src/lib/views/CollectUserDataView/UserDataFields/index.js +4 -0
- package/src/lib/views/EmailUpdate/EmailUpdate.cjs +13 -4
- package/src/lib/views/EmailUpdate/EmailUpdate.js +13 -4
- package/src/lib/views/EmailVerification/EmailVerification.cjs +6 -1
- package/src/lib/views/EmailVerification/EmailVerification.js +7 -2
- package/src/lib/views/EmailWalletOTPVerificationView/EmailWalletOTPVerificationView.cjs +3 -2
- package/src/lib/views/EmailWalletOTPVerificationView/EmailWalletOTPVerificationView.js +3 -2
- package/src/lib/views/LoginWithEmailView/components/LoginWithEmailWalletList/LoginWithEmailWalletList.cjs +4 -1
- package/src/lib/views/LoginWithEmailView/components/LoginWithEmailWalletList/LoginWithEmailWalletList.js +4 -1
- package/src/lib/views/LoginWithEmailView/components/SocialSignIn/SocialSignIn.cjs +1 -1
- package/src/lib/views/LoginWithEmailView/components/SocialSignIn/SocialSignIn.js +1 -1
- package/src/lib/views/MergeUserAccountsView/MergeUserAccountsView.cjs +9 -1
- package/src/lib/views/MergeUserAccountsView/MergeUserAccountsView.js +9 -1
- package/src/lib/views/NetworkNotSupported/NetworkNotSupported.cjs +1 -0
- package/src/lib/views/NetworkNotSupported/NetworkNotSupported.js +1 -0
- package/src/lib/views/NetworkNotSupportedSwitchManual/NetworkNotSupportedSwitchManual.cjs +1 -0
- package/src/lib/views/NetworkNotSupportedSwitchManual/NetworkNotSupportedSwitchManual.js +1 -0
- package/src/lib/views/SendBalanceView/SendBalanceView.cjs +11 -16
- package/src/lib/views/SendBalanceView/SendBalanceView.js +11 -16
- package/src/lib/views/SendBalanceView/components/TransactionStage/TransactionStage.cjs +66 -0
- package/src/lib/views/SendBalanceView/components/TransactionStage/TransactionStage.d.ts +8 -0
- package/src/lib/views/SendBalanceView/components/TransactionStage/TransactionStage.js +62 -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/SocialRedirectView/SocialRedirectView.cjs +1 -2
- package/src/lib/views/SocialRedirectView/SocialRedirectView.js +1 -2
- package/src/lib/views/TransactionConfirmationView/TransactionConfirmationView.cjs +22 -4
- package/src/lib/views/TransactionConfirmationView/TransactionConfirmationView.js +22 -4
- package/src/lib/views/TransactionConfirmationView/hooks/index.d.ts +2 -1
- package/src/lib/views/TransactionConfirmationView/hooks/useTransactionGas/index.d.ts +1 -0
- package/src/lib/views/TransactionConfirmationView/hooks/{useTransactionData/useTransactionData.cjs → useTransactionGas/useTransactionGas.cjs} +17 -42
- package/src/lib/views/TransactionConfirmationView/hooks/useTransactionGas/useTransactionGas.d.ts +11 -0
- package/src/lib/views/TransactionConfirmationView/hooks/{useTransactionData/useTransactionData.js → useTransactionGas/useTransactionGas.js} +18 -43
- package/src/lib/views/TransactionConfirmationView/hooks/useTransactionTotal/index.d.ts +1 -0
- package/src/lib/views/TransactionConfirmationView/hooks/useTransactionTotal/useTransactionTotal.cjs +14 -0
- package/src/lib/views/TransactionConfirmationView/hooks/useTransactionTotal/useTransactionTotal.d.ts +7 -0
- package/src/lib/views/TransactionConfirmationView/hooks/useTransactionTotal/useTransactionTotal.js +10 -0
- package/src/lib/views/WalletList/WalletList.cjs +4 -1
- package/src/lib/views/WalletList/WalletList.js +4 -1
- package/src/lib/views/WalletLockedView/WalletLockedView.cjs +20 -4
- package/src/lib/views/WalletLockedView/WalletLockedView.js +20 -4
- package/src/lib/views/TransactionConfirmationView/hooks/useTransactionData/index.d.ts +0 -1
- package/src/lib/views/TransactionConfirmationView/hooks/useTransactionData/useTransactionData.d.ts +0 -18
|
@@ -43,54 +43,29 @@ require('../../../../context/MockContext/MockContext.cjs');
|
|
|
43
43
|
require('../../../../context/CaptchaContext/CaptchaContext.cjs');
|
|
44
44
|
var usePromise = require('../../../../utils/hooks/usePromise/usePromise.cjs');
|
|
45
45
|
require('../../../../utils/hooks/useUserUpdateRequest/useUserUpdateRequest.cjs');
|
|
46
|
+
var useTransactionEstimatedGas = require('../../../../utils/hooks/useTransactionEstimatedGas/useTransactionEstimatedGas.cjs');
|
|
46
47
|
|
|
47
|
-
const
|
|
48
|
-
const { data:
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
const transactionWithNoOrigin = _tslib.__rest(transaction, ["from"]);
|
|
58
|
-
return provider.estimateGas(transactionWithNoOrigin);
|
|
48
|
+
const useTransactionGas = ({ provider, transaction, }) => {
|
|
49
|
+
const { data: estimatedGas, isLoading: isEstimatedGasLoading } = useTransactionEstimatedGas.useTransactionEstimatedGas(provider, transaction);
|
|
50
|
+
const { data: gasPrice, isLoading: isLoadingGasPrice } = usePromise.usePromise(() => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
51
|
+
if (transaction.gasPrice) {
|
|
52
|
+
const gasPrice = yield transaction.gasPrice;
|
|
53
|
+
return gasPrice ? ethers.ethers.BigNumber.from(gasPrice) : undefined;
|
|
54
|
+
}
|
|
55
|
+
return provider.getGasPrice();
|
|
56
|
+
}), {
|
|
57
|
+
deps: [transaction.gasPrice],
|
|
59
58
|
});
|
|
60
|
-
const
|
|
61
|
-
const isGasPriceLoading = isEstimatedGasLoading || isFeeDataLoading;
|
|
62
|
-
const gasEstimate = React.useMemo(() => gasPrice && estimatedGas
|
|
59
|
+
const gasTotalPrice = React.useMemo(() => gasPrice && estimatedGas
|
|
63
60
|
? ethers.ethers.BigNumber.from(gasPrice).mul(estimatedGas)
|
|
64
61
|
: undefined, [gasPrice, estimatedGas]);
|
|
65
|
-
const
|
|
66
|
-
const
|
|
67
|
-
const total = React.useMemo(() => {
|
|
68
|
-
if (gasEstimate !== undefined && transactionValue !== undefined) {
|
|
69
|
-
return gasEstimate.add(transactionValue);
|
|
70
|
-
}
|
|
71
|
-
return transactionValue || gasEstimate;
|
|
72
|
-
}, [gasEstimate, transactionValue]);
|
|
73
|
-
const isLoading = React.useMemo(() => isEffectiveValueLoading ||
|
|
74
|
-
isGasPriceLoading ||
|
|
75
|
-
isTransactionToAddressLoading ||
|
|
76
|
-
isTransactionFromAddressLoading, [
|
|
77
|
-
isEffectiveValueLoading,
|
|
78
|
-
isGasPriceLoading,
|
|
79
|
-
isTransactionToAddressLoading,
|
|
80
|
-
isTransactionFromAddressLoading,
|
|
81
|
-
]);
|
|
62
|
+
const isLoading = isEstimatedGasLoading || isLoadingGasPrice;
|
|
63
|
+
const isGasEstimated = Boolean(estimatedGas) && !transaction.gasPrice;
|
|
82
64
|
return {
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
isGasPriceLoading,
|
|
65
|
+
gasTotalPrice,
|
|
66
|
+
isGasEstimated,
|
|
86
67
|
isLoading,
|
|
87
|
-
isTransactionFromAddressLoading,
|
|
88
|
-
isTransactionToAddressLoading,
|
|
89
|
-
total,
|
|
90
|
-
transactionFromAddress,
|
|
91
|
-
transactionToAddress,
|
|
92
|
-
transactionValue,
|
|
93
68
|
};
|
|
94
69
|
};
|
|
95
70
|
|
|
96
|
-
exports.
|
|
71
|
+
exports.useTransactionGas = useTransactionGas;
|
package/src/lib/views/TransactionConfirmationView/hooks/useTransactionGas/useTransactionGas.d.ts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { ethers } from 'ethers';
|
|
2
|
+
type UseTransactionGasProps = {
|
|
3
|
+
provider: ethers.providers.Web3Provider;
|
|
4
|
+
transaction: ethers.utils.Deferrable<ethers.providers.TransactionRequest>;
|
|
5
|
+
};
|
|
6
|
+
export declare const useTransactionGas: ({ provider, transaction, }: UseTransactionGasProps) => {
|
|
7
|
+
gasTotalPrice: ethers.BigNumber | undefined;
|
|
8
|
+
isGasEstimated: boolean;
|
|
9
|
+
isLoading: boolean;
|
|
10
|
+
};
|
|
11
|
+
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { __awaiter
|
|
1
|
+
import { __awaiter } from '../../../../../../_virtual/_tslib.js';
|
|
2
2
|
import { useMemo } from 'react';
|
|
3
3
|
import { ethers } from 'ethers';
|
|
4
4
|
import '@dynamic-labs/utils';
|
|
@@ -39,54 +39,29 @@ import '../../../../context/MockContext/MockContext.js';
|
|
|
39
39
|
import '../../../../context/CaptchaContext/CaptchaContext.js';
|
|
40
40
|
import { usePromise } from '../../../../utils/hooks/usePromise/usePromise.js';
|
|
41
41
|
import '../../../../utils/hooks/useUserUpdateRequest/useUserUpdateRequest.js';
|
|
42
|
+
import { useTransactionEstimatedGas } from '../../../../utils/hooks/useTransactionEstimatedGas/useTransactionEstimatedGas.js';
|
|
42
43
|
|
|
43
|
-
const
|
|
44
|
-
const { data:
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
const transactionWithNoOrigin = __rest(transaction, ["from"]);
|
|
54
|
-
return provider.estimateGas(transactionWithNoOrigin);
|
|
44
|
+
const useTransactionGas = ({ provider, transaction, }) => {
|
|
45
|
+
const { data: estimatedGas, isLoading: isEstimatedGasLoading } = useTransactionEstimatedGas(provider, transaction);
|
|
46
|
+
const { data: gasPrice, isLoading: isLoadingGasPrice } = usePromise(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
47
|
+
if (transaction.gasPrice) {
|
|
48
|
+
const gasPrice = yield transaction.gasPrice;
|
|
49
|
+
return gasPrice ? ethers.BigNumber.from(gasPrice) : undefined;
|
|
50
|
+
}
|
|
51
|
+
return provider.getGasPrice();
|
|
52
|
+
}), {
|
|
53
|
+
deps: [transaction.gasPrice],
|
|
55
54
|
});
|
|
56
|
-
const
|
|
57
|
-
const isGasPriceLoading = isEstimatedGasLoading || isFeeDataLoading;
|
|
58
|
-
const gasEstimate = useMemo(() => gasPrice && estimatedGas
|
|
55
|
+
const gasTotalPrice = useMemo(() => gasPrice && estimatedGas
|
|
59
56
|
? ethers.BigNumber.from(gasPrice).mul(estimatedGas)
|
|
60
57
|
: undefined, [gasPrice, estimatedGas]);
|
|
61
|
-
const
|
|
62
|
-
const
|
|
63
|
-
const total = useMemo(() => {
|
|
64
|
-
if (gasEstimate !== undefined && transactionValue !== undefined) {
|
|
65
|
-
return gasEstimate.add(transactionValue);
|
|
66
|
-
}
|
|
67
|
-
return transactionValue || gasEstimate;
|
|
68
|
-
}, [gasEstimate, transactionValue]);
|
|
69
|
-
const isLoading = useMemo(() => isEffectiveValueLoading ||
|
|
70
|
-
isGasPriceLoading ||
|
|
71
|
-
isTransactionToAddressLoading ||
|
|
72
|
-
isTransactionFromAddressLoading, [
|
|
73
|
-
isEffectiveValueLoading,
|
|
74
|
-
isGasPriceLoading,
|
|
75
|
-
isTransactionToAddressLoading,
|
|
76
|
-
isTransactionFromAddressLoading,
|
|
77
|
-
]);
|
|
58
|
+
const isLoading = isEstimatedGasLoading || isLoadingGasPrice;
|
|
59
|
+
const isGasEstimated = Boolean(estimatedGas) && !transaction.gasPrice;
|
|
78
60
|
return {
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
isGasPriceLoading,
|
|
61
|
+
gasTotalPrice,
|
|
62
|
+
isGasEstimated,
|
|
82
63
|
isLoading,
|
|
83
|
-
isTransactionFromAddressLoading,
|
|
84
|
-
isTransactionToAddressLoading,
|
|
85
|
-
total,
|
|
86
|
-
transactionFromAddress,
|
|
87
|
-
transactionToAddress,
|
|
88
|
-
transactionValue,
|
|
89
64
|
};
|
|
90
65
|
};
|
|
91
66
|
|
|
92
|
-
export {
|
|
67
|
+
export { useTransactionGas };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { useTransactionTotal } from './useTransactionTotal';
|
package/src/lib/views/TransactionConfirmationView/hooks/useTransactionTotal/useTransactionTotal.cjs
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var React = require('react');
|
|
6
|
+
|
|
7
|
+
const useTransactionTotal = ({ transactionValue, gasTotalPrice, }) => React.useMemo(() => {
|
|
8
|
+
if (gasTotalPrice !== undefined && transactionValue !== undefined) {
|
|
9
|
+
return gasTotalPrice.add(transactionValue);
|
|
10
|
+
}
|
|
11
|
+
return transactionValue || gasTotalPrice;
|
|
12
|
+
}, [gasTotalPrice, transactionValue]);
|
|
13
|
+
|
|
14
|
+
exports.useTransactionTotal = useTransactionTotal;
|
package/src/lib/views/TransactionConfirmationView/hooks/useTransactionTotal/useTransactionTotal.d.ts
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { ethers } from 'ethers';
|
|
2
|
+
type UseTransactionTotalProps = {
|
|
3
|
+
transactionValue?: ethers.BigNumber;
|
|
4
|
+
gasTotalPrice?: ethers.BigNumber;
|
|
5
|
+
};
|
|
6
|
+
export declare const useTransactionTotal: ({ transactionValue, gasTotalPrice, }: UseTransactionTotalProps) => ethers.BigNumber | undefined;
|
|
7
|
+
export {};
|
package/src/lib/views/TransactionConfirmationView/hooks/useTransactionTotal/useTransactionTotal.js
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { useMemo } from 'react';
|
|
2
|
+
|
|
3
|
+
const useTransactionTotal = ({ transactionValue, gasTotalPrice, }) => useMemo(() => {
|
|
4
|
+
if (gasTotalPrice !== undefined && transactionValue !== undefined) {
|
|
5
|
+
return gasTotalPrice.add(transactionValue);
|
|
6
|
+
}
|
|
7
|
+
return transactionValue || gasTotalPrice;
|
|
8
|
+
}, [gasTotalPrice, transactionValue]);
|
|
9
|
+
|
|
10
|
+
export { useTransactionTotal };
|
|
@@ -78,7 +78,10 @@ const WalletList = ({ isWalletConnectList = false, }) => {
|
|
|
78
78
|
};
|
|
79
79
|
return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsxs("div", Object.assign({ className: 'wallet-list__container' }, { children: [error && jsxRuntime.jsx(ErrorContainer.ErrorContainer, { children: error }), !projectSettings ? (jsxRuntime.jsx(Skeleton.Skeleton, { className: 'wallet-list__search-skeleton' })) : (isSearchEnabled && (jsxRuntime.jsx(Search.Search, { label: `Search through ${numberOfWallets} wallets...`, value: filterValue, onChange: ({ target: { value } }) => handleFilterValueChange(value), onClickClear: () => handleFilterValueChange('') }))), jsxRuntime.jsxs("div", Object.assign({ className: classNames.classNames('wallet-list__scroll-container', {
|
|
80
80
|
'wallet-list__scroll-container--full-height': isSearchEnabled,
|
|
81
|
-
}), "data-testid": 'wallet-list-scroll-container', ref: walletListScrollRef, onScroll: handleScroll }, { children: [!projectSettings ? (jsxRuntime.jsx(Skeleton.Skeleton, { count: 10, className: 'wallet-list__tile-skeleton' })) : (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [wallets.length === 0 && (jsxRuntime.jsx(ErrorContainer.ErrorContainer, { children: "Oops, no login methods have been configured." })), wallets.length && walletsList.length === 0 ? (jsxRuntime.jsx(SearchNotFoundMessage.SearchNotFoundMessage, { title: 'No wallet found.', subtitle: 'Try searching for a different wallet', image: jsxRuntime.jsx(noWalletFound.ReactComponent, {}) })) : (walletsList.map((wallet) =>
|
|
81
|
+
}), "data-testid": 'wallet-list-scroll-container', ref: walletListScrollRef, onScroll: handleScroll }, { children: [!projectSettings ? (jsxRuntime.jsx(Skeleton.Skeleton, { count: 10, className: 'wallet-list__tile-skeleton' })) : (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [wallets.length === 0 && (jsxRuntime.jsx(ErrorContainer.ErrorContainer, { children: "Oops, no login methods have been configured." })), wallets.length && walletsList.length === 0 ? (jsxRuntime.jsx(SearchNotFoundMessage.SearchNotFoundMessage, { title: 'No wallet found.', subtitle: 'Try searching for a different wallet', image: jsxRuntime.jsx(noWalletFound.ReactComponent, {}) })) : (walletsList.map((wallet) => {
|
|
82
|
+
var _a;
|
|
83
|
+
return (jsxRuntime.jsx(WalletListItem.WalletListItem, { wallet: wallet, usingMultiWallet: isUsingMultiWallet, onResetSearchValue: () => handleFilterValueChange('') }, wallet.key + ((_a = wallet.groupedWallets) === null || _a === void 0 ? void 0 : _a.length)));
|
|
84
|
+
}))] })), isSearchEnabled && !filterValue && projectSettings && (jsxRuntime.jsx(SearchNotFoundMessage.SearchNotFoundMessage, {}))] }))] })), noDefaultFooter && (jsxRuntime.jsx("div", { className: classNames.classNames('wallet-list__tiny-footer', {
|
|
82
85
|
'wallet-list__tiny-footer--hidden': footerIsVisible,
|
|
83
86
|
}), "data-testid": 'wallet-list-tiny-footer' }))] }));
|
|
84
87
|
};
|
|
@@ -74,7 +74,10 @@ const WalletList = ({ isWalletConnectList = false, }) => {
|
|
|
74
74
|
};
|
|
75
75
|
return (jsxs(Fragment, { children: [jsxs("div", Object.assign({ className: 'wallet-list__container' }, { children: [error && jsx(ErrorContainer, { children: error }), !projectSettings ? (jsx(Skeleton, { className: 'wallet-list__search-skeleton' })) : (isSearchEnabled && (jsx(Search, { label: `Search through ${numberOfWallets} wallets...`, value: filterValue, onChange: ({ target: { value } }) => handleFilterValueChange(value), onClickClear: () => handleFilterValueChange('') }))), jsxs("div", Object.assign({ className: classNames('wallet-list__scroll-container', {
|
|
76
76
|
'wallet-list__scroll-container--full-height': isSearchEnabled,
|
|
77
|
-
}), "data-testid": 'wallet-list-scroll-container', ref: walletListScrollRef, onScroll: handleScroll }, { children: [!projectSettings ? (jsx(Skeleton, { count: 10, className: 'wallet-list__tile-skeleton' })) : (jsxs(Fragment, { children: [wallets.length === 0 && (jsx(ErrorContainer, { children: "Oops, no login methods have been configured." })), wallets.length && walletsList.length === 0 ? (jsx(SearchNotFoundMessage, { title: 'No wallet found.', subtitle: 'Try searching for a different wallet', image: jsx(SvgNoWalletFound, {}) })) : (walletsList.map((wallet) =>
|
|
77
|
+
}), "data-testid": 'wallet-list-scroll-container', ref: walletListScrollRef, onScroll: handleScroll }, { children: [!projectSettings ? (jsx(Skeleton, { count: 10, className: 'wallet-list__tile-skeleton' })) : (jsxs(Fragment, { children: [wallets.length === 0 && (jsx(ErrorContainer, { children: "Oops, no login methods have been configured." })), wallets.length && walletsList.length === 0 ? (jsx(SearchNotFoundMessage, { title: 'No wallet found.', subtitle: 'Try searching for a different wallet', image: jsx(SvgNoWalletFound, {}) })) : (walletsList.map((wallet) => {
|
|
78
|
+
var _a;
|
|
79
|
+
return (jsx(WalletListItem, { wallet: wallet, usingMultiWallet: isUsingMultiWallet, onResetSearchValue: () => handleFilterValueChange('') }, wallet.key + ((_a = wallet.groupedWallets) === null || _a === void 0 ? void 0 : _a.length)));
|
|
80
|
+
}))] })), isSearchEnabled && !filterValue && projectSettings && (jsx(SearchNotFoundMessage, {}))] }))] })), noDefaultFooter && (jsx("div", { className: classNames('wallet-list__tiny-footer', {
|
|
78
81
|
'wallet-list__tiny-footer--hidden': footerIsVisible,
|
|
79
82
|
}), "data-testid": 'wallet-list-tiny-footer' }))] }));
|
|
80
83
|
};
|
|
@@ -2,12 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
+
var _tslib = require('../../../../_virtual/_tslib.cjs');
|
|
5
6
|
var jsxRuntime = require('react/jsx-runtime');
|
|
7
|
+
var React = require('react');
|
|
6
8
|
var walletBook = require('@dynamic-labs/wallet-book');
|
|
7
|
-
require('react');
|
|
8
9
|
var Typography = require('../../components/Typography/Typography.cjs');
|
|
9
10
|
require('@dynamic-labs/sdk-api');
|
|
10
|
-
require('../../shared/logger.cjs');
|
|
11
|
+
var logger = require('../../shared/logger.cjs');
|
|
11
12
|
require('@dynamic-labs/iconic');
|
|
12
13
|
require('@dynamic-labs/wallet-connector-core');
|
|
13
14
|
require('../../context/ViewContext/ViewContext.cjs');
|
|
@@ -51,15 +52,30 @@ require('../../components/MenuList/Dropdown/Dropdown.cjs');
|
|
|
51
52
|
|
|
52
53
|
const iconSize = 64;
|
|
53
54
|
const WalletLockedView = () => {
|
|
54
|
-
const { handleLogOut, primaryWallet, setShowAuthFlow } = useInternalDynamicContext.useInternalDynamicContext();
|
|
55
|
+
const { handleLogOut, primaryWallet, setShowAuthFlow, appName, authToken } = useInternalDynamicContext.useInternalDynamicContext();
|
|
56
|
+
React.useEffect(() => {
|
|
57
|
+
// when there is no valid session, we want to log user out
|
|
58
|
+
if (!authToken) {
|
|
59
|
+
handleLogOut();
|
|
60
|
+
}
|
|
61
|
+
}, [authToken, handleLogOut]);
|
|
55
62
|
if (!primaryWallet) {
|
|
56
63
|
return null;
|
|
57
64
|
}
|
|
65
|
+
const handleConnectWallet = () => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
66
|
+
try {
|
|
67
|
+
yield primaryWallet.connector.connect();
|
|
68
|
+
setShowAuthFlow(false);
|
|
69
|
+
}
|
|
70
|
+
catch (_a) {
|
|
71
|
+
logger.logger.info('could not connect wallet');
|
|
72
|
+
}
|
|
73
|
+
});
|
|
58
74
|
const icon = (jsxRuntime.jsx(walletBook.WalletIcon, { walletName: primaryWallet.connector.name, style: {
|
|
59
75
|
height: pixelToRem.pixelToRem(iconSize * IconWithSpinner.iconRatio),
|
|
60
76
|
width: pixelToRem.pixelToRem(iconSize * IconWithSpinner.iconRatio),
|
|
61
77
|
} }));
|
|
62
|
-
return (jsxRuntime.jsxs("div", Object.assign({ "data-testid": 'wallet-locked-view' }, { children: [jsxRuntime.jsx(ErrorContainer.ErrorContainer, Object.assign({ withIcon: false, className: 'wallet-locked-view__error-container' }, { children: "
|
|
78
|
+
return (jsxRuntime.jsxs("div", Object.assign({ "data-testid": 'wallet-locked-view' }, { children: [jsxRuntime.jsx(ErrorContainer.ErrorContainer, Object.assign({ withIcon: false, variant: 'success', className: 'wallet-locked-view__error-container' }, { children: "Connect your wallet to continue" })), jsxRuntime.jsxs("div", Object.assign({ className: 'wallet-locked-view__content' }, { children: [jsxRuntime.jsx(IconWithSpinner.IconWithSpinner, { Icon: icon, iconSize: iconSize, className: 'wallet-locked-view__icon', isSpinning: true }), jsxRuntime.jsx(Typography.Typography, Object.assign({ variant: 'title', color: 'primary', weight: 'medium', className: 'wallet-locked-view__title' }, { children: "Welcome back." })), jsxRuntime.jsxs(Typography.Typography, Object.assign({ variant: 'body_normal', color: 'secondary', weight: 'regular' }, { children: ["We couldn't connect to your wallet. Click connect to retry the connection ", appName, "."] })), jsxRuntime.jsx(Button.Button, Object.assign({ buttonRounded: 'default', onClick: () => handleConnectWallet(), buttonClassName: 'wallet-locked-view__button' }, { children: "Connect wallet" })), jsxRuntime.jsx(Divider.Divider, { text: 'Or' }), jsxRuntime.jsx(TextButton.TextButton, Object.assign({ className: 'wallet-locked-view__log-out', onClick: handleLogOut }, { children: "Log out" }))] }))] })));
|
|
63
79
|
};
|
|
64
80
|
|
|
65
81
|
exports.WalletLockedView = WalletLockedView;
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
+
import { __awaiter } from '../../../../_virtual/_tslib.js';
|
|
1
2
|
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
3
|
+
import { useEffect } from 'react';
|
|
2
4
|
import { WalletIcon } from '@dynamic-labs/wallet-book';
|
|
3
|
-
import 'react';
|
|
4
5
|
import { Typography } from '../../components/Typography/Typography.js';
|
|
5
6
|
import '@dynamic-labs/sdk-api';
|
|
6
|
-
import '../../shared/logger.js';
|
|
7
|
+
import { logger } from '../../shared/logger.js';
|
|
7
8
|
import '@dynamic-labs/iconic';
|
|
8
9
|
import '@dynamic-labs/wallet-connector-core';
|
|
9
10
|
import '../../context/ViewContext/ViewContext.js';
|
|
@@ -47,15 +48,30 @@ import '../../components/MenuList/Dropdown/Dropdown.js';
|
|
|
47
48
|
|
|
48
49
|
const iconSize = 64;
|
|
49
50
|
const WalletLockedView = () => {
|
|
50
|
-
const { handleLogOut, primaryWallet, setShowAuthFlow } = useInternalDynamicContext();
|
|
51
|
+
const { handleLogOut, primaryWallet, setShowAuthFlow, appName, authToken } = useInternalDynamicContext();
|
|
52
|
+
useEffect(() => {
|
|
53
|
+
// when there is no valid session, we want to log user out
|
|
54
|
+
if (!authToken) {
|
|
55
|
+
handleLogOut();
|
|
56
|
+
}
|
|
57
|
+
}, [authToken, handleLogOut]);
|
|
51
58
|
if (!primaryWallet) {
|
|
52
59
|
return null;
|
|
53
60
|
}
|
|
61
|
+
const handleConnectWallet = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
62
|
+
try {
|
|
63
|
+
yield primaryWallet.connector.connect();
|
|
64
|
+
setShowAuthFlow(false);
|
|
65
|
+
}
|
|
66
|
+
catch (_a) {
|
|
67
|
+
logger.info('could not connect wallet');
|
|
68
|
+
}
|
|
69
|
+
});
|
|
54
70
|
const icon = (jsx(WalletIcon, { walletName: primaryWallet.connector.name, style: {
|
|
55
71
|
height: pixelToRem(iconSize * iconRatio),
|
|
56
72
|
width: pixelToRem(iconSize * iconRatio),
|
|
57
73
|
} }));
|
|
58
|
-
return (jsxs("div", Object.assign({ "data-testid": 'wallet-locked-view' }, { children: [jsx(ErrorContainer, Object.assign({ withIcon: false, className: 'wallet-locked-view__error-container' }, { children: "
|
|
74
|
+
return (jsxs("div", Object.assign({ "data-testid": 'wallet-locked-view' }, { children: [jsx(ErrorContainer, Object.assign({ withIcon: false, variant: 'success', className: 'wallet-locked-view__error-container' }, { children: "Connect your wallet to continue" })), jsxs("div", Object.assign({ className: 'wallet-locked-view__content' }, { children: [jsx(IconWithSpinner, { Icon: icon, iconSize: iconSize, className: 'wallet-locked-view__icon', isSpinning: true }), jsx(Typography, Object.assign({ variant: 'title', color: 'primary', weight: 'medium', className: 'wallet-locked-view__title' }, { children: "Welcome back." })), jsxs(Typography, Object.assign({ variant: 'body_normal', color: 'secondary', weight: 'regular' }, { children: ["We couldn't connect to your wallet. Click connect to retry the connection ", appName, "."] })), jsx(Button, Object.assign({ buttonRounded: 'default', onClick: () => handleConnectWallet(), buttonClassName: 'wallet-locked-view__button' }, { children: "Connect wallet" })), jsx(Divider, { text: 'Or' }), jsx(TextButton, Object.assign({ className: 'wallet-locked-view__log-out', onClick: handleLogOut }, { children: "Log out" }))] }))] })));
|
|
59
75
|
};
|
|
60
76
|
|
|
61
77
|
export { WalletLockedView };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { useTransactionData } from './useTransactionData';
|
package/src/lib/views/TransactionConfirmationView/hooks/useTransactionData/useTransactionData.d.ts
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { ethers } from 'ethers';
|
|
2
|
-
type TransactionDataHookProps = {
|
|
3
|
-
provider: ethers.providers.Web3Provider;
|
|
4
|
-
transaction: ethers.utils.Deferrable<ethers.providers.TransactionRequest>;
|
|
5
|
-
};
|
|
6
|
-
export declare const useTransactionData: ({ provider, transaction, }: TransactionDataHookProps) => {
|
|
7
|
-
gasEstimate: ethers.BigNumber | undefined;
|
|
8
|
-
isEffectiveValueLoading: boolean;
|
|
9
|
-
isGasPriceLoading: boolean;
|
|
10
|
-
isLoading: boolean;
|
|
11
|
-
isTransactionFromAddressLoading: boolean;
|
|
12
|
-
isTransactionToAddressLoading: boolean;
|
|
13
|
-
total: ethers.BigNumber | undefined;
|
|
14
|
-
transactionFromAddress: string | undefined;
|
|
15
|
-
transactionToAddress: string | undefined;
|
|
16
|
-
transactionValue: ethers.BigNumber | undefined;
|
|
17
|
-
};
|
|
18
|
-
export {};
|