@dynamic-labs/sdk-react-core 0.19.0-alpha.14 → 0.19.0-alpha.15
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 +2 -0
- package/package.cjs +1 -1
- package/package.js +1 -1
- package/package.json +8 -8
- package/src/lib/utils/hooks/useWalletUiUtils/useWalletUiUtils.cjs +1 -1
- package/src/lib/utils/hooks/useWalletUiUtils/useWalletUiUtils.js +1 -1
- package/src/lib/views/TransactionConfirmationView/helpers/transactionErrorMessage.cjs +8 -0
- package/src/lib/views/TransactionConfirmationView/helpers/transactionErrorMessage.d.ts +9 -2
- package/src/lib/views/TransactionConfirmationView/helpers/transactionErrorMessage.js +8 -0
package/CHANGELOG.md
CHANGED
package/package.cjs
CHANGED
package/package.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dynamic-labs/sdk-react-core",
|
|
3
|
-
"version": "0.19.0-alpha.
|
|
3
|
+
"version": "0.19.0-alpha.15",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "https://github.com/dynamic-labs/DynamicAuth.git",
|
|
@@ -17,13 +17,13 @@
|
|
|
17
17
|
"react-focus-lock": "2.9.2",
|
|
18
18
|
"react-i18next": "^13.2.0",
|
|
19
19
|
"yup": "0.32.11",
|
|
20
|
-
"@dynamic-labs/logger": "0.19.0-alpha.
|
|
21
|
-
"@dynamic-labs/multi-wallet": "0.19.0-alpha.
|
|
22
|
-
"@dynamic-labs/rpc-providers": "0.19.0-alpha.
|
|
23
|
-
"@dynamic-labs/types": "0.19.0-alpha.
|
|
24
|
-
"@dynamic-labs/utils": "0.19.0-alpha.
|
|
25
|
-
"@dynamic-labs/wallet-book": "0.19.0-alpha.
|
|
26
|
-
"@dynamic-labs/wallet-connector-core": "0.19.0-alpha.
|
|
20
|
+
"@dynamic-labs/logger": "0.19.0-alpha.15",
|
|
21
|
+
"@dynamic-labs/multi-wallet": "0.19.0-alpha.15",
|
|
22
|
+
"@dynamic-labs/rpc-providers": "0.19.0-alpha.15",
|
|
23
|
+
"@dynamic-labs/types": "0.19.0-alpha.15",
|
|
24
|
+
"@dynamic-labs/utils": "0.19.0-alpha.15",
|
|
25
|
+
"@dynamic-labs/wallet-book": "0.19.0-alpha.15",
|
|
26
|
+
"@dynamic-labs/wallet-connector-core": "0.19.0-alpha.15",
|
|
27
27
|
"eventemitter3": "5.0.1"
|
|
28
28
|
},
|
|
29
29
|
"devDependencies": {
|
|
@@ -85,7 +85,7 @@ const useWalletUiUtils = ({ appLogoUrl, appName, getAppOrigin, }) => {
|
|
|
85
85
|
if (!shouldConfirmAction()) {
|
|
86
86
|
return handler(transaction);
|
|
87
87
|
}
|
|
88
|
-
return openSendTransaction((resolve, reject) => (jsxRuntime.jsx(TransactionConfirmationModal.TransactionConfirmationModal, { walletConnector: connector, title: '
|
|
88
|
+
return openSendTransaction((resolve, reject) => (jsxRuntime.jsx(TransactionConfirmationModal.TransactionConfirmationModal, { walletConnector: connector, title: 'Confirm Transaction', transaction: transaction, handler: handler, onTransactionResponseSuccess: resolve, onReject: reject, provider: provider })));
|
|
89
89
|
}), [openSendTransaction, shouldConfirmAction]);
|
|
90
90
|
const disabledConfirmationOnce = React.useCallback(() => {
|
|
91
91
|
confirmationStateRef.current = 'disabled';
|
|
@@ -81,7 +81,7 @@ const useWalletUiUtils = ({ appLogoUrl, appName, getAppOrigin, }) => {
|
|
|
81
81
|
if (!shouldConfirmAction()) {
|
|
82
82
|
return handler(transaction);
|
|
83
83
|
}
|
|
84
|
-
return openSendTransaction((resolve, reject) => (jsx(TransactionConfirmationModal, { walletConnector: connector, title: '
|
|
84
|
+
return openSendTransaction((resolve, reject) => (jsx(TransactionConfirmationModal, { walletConnector: connector, title: 'Confirm Transaction', transaction: transaction, handler: handler, onTransactionResponseSuccess: resolve, onReject: reject, provider: provider })));
|
|
85
85
|
}), [openSendTransaction, shouldConfirmAction]);
|
|
86
86
|
const disabledConfirmationOnce = useCallback(() => {
|
|
87
87
|
confirmationStateRef.current = 'disabled';
|
|
@@ -18,15 +18,23 @@ require('../../../shared/consts/index.cjs');
|
|
|
18
18
|
|
|
19
19
|
const errorCodesMapping = {
|
|
20
20
|
'-32603': 'Could not replace existing transaction',
|
|
21
|
+
0: 'The operation either timed out or was not allowed.',
|
|
22
|
+
16: 'Invalid Passkey signature. Select the passkey for this account and device.',
|
|
21
23
|
INSUFFICIENT_FUNDS: 'Insufficient funds for this transaction.',
|
|
22
24
|
};
|
|
23
25
|
const errorReasonsMapping = {
|
|
24
26
|
'provided ENS name resolves to null': 'Invalid address. Please check that the entered address is correct.',
|
|
25
27
|
};
|
|
26
28
|
const transactionErrorMessage = (error) => {
|
|
29
|
+
var _a;
|
|
27
30
|
logger.logger.debug('transaction error]:', error);
|
|
28
31
|
const { code } = error;
|
|
29
32
|
const defaultMessage = 'Something went wrong.';
|
|
33
|
+
// turnkey request errors
|
|
34
|
+
if (((_a = error === null || error === void 0 ? void 0 : error.cause) === null || _a === void 0 ? void 0 : _a.code) !== undefined &&
|
|
35
|
+
errorCodesMapping[error.cause.code] !== undefined) {
|
|
36
|
+
return errorCodesMapping[error.cause.code];
|
|
37
|
+
}
|
|
30
38
|
if (!code)
|
|
31
39
|
return defaultMessage;
|
|
32
40
|
return (errorCodesMapping[code] ||
|
|
@@ -1,4 +1,11 @@
|
|
|
1
|
-
|
|
1
|
+
type TransactionError = Error & {
|
|
2
2
|
code?: string;
|
|
3
3
|
reason?: string;
|
|
4
|
-
|
|
4
|
+
cause?: {
|
|
5
|
+
code: number;
|
|
6
|
+
name: string;
|
|
7
|
+
message: string;
|
|
8
|
+
};
|
|
9
|
+
};
|
|
10
|
+
export declare const transactionErrorMessage: (error: TransactionError) => string;
|
|
11
|
+
export {};
|
|
@@ -14,15 +14,23 @@ import '../../../shared/consts/index.js';
|
|
|
14
14
|
|
|
15
15
|
const errorCodesMapping = {
|
|
16
16
|
'-32603': 'Could not replace existing transaction',
|
|
17
|
+
0: 'The operation either timed out or was not allowed.',
|
|
18
|
+
16: 'Invalid Passkey signature. Select the passkey for this account and device.',
|
|
17
19
|
INSUFFICIENT_FUNDS: 'Insufficient funds for this transaction.',
|
|
18
20
|
};
|
|
19
21
|
const errorReasonsMapping = {
|
|
20
22
|
'provided ENS name resolves to null': 'Invalid address. Please check that the entered address is correct.',
|
|
21
23
|
};
|
|
22
24
|
const transactionErrorMessage = (error) => {
|
|
25
|
+
var _a;
|
|
23
26
|
logger.debug('transaction error]:', error);
|
|
24
27
|
const { code } = error;
|
|
25
28
|
const defaultMessage = 'Something went wrong.';
|
|
29
|
+
// turnkey request errors
|
|
30
|
+
if (((_a = error === null || error === void 0 ? void 0 : error.cause) === null || _a === void 0 ? void 0 : _a.code) !== undefined &&
|
|
31
|
+
errorCodesMapping[error.cause.code] !== undefined) {
|
|
32
|
+
return errorCodesMapping[error.cause.code];
|
|
33
|
+
}
|
|
26
34
|
if (!code)
|
|
27
35
|
return defaultMessage;
|
|
28
36
|
return (errorCodesMapping[code] ||
|