@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 CHANGED
@@ -1,4 +1,6 @@
1
1
 
2
+ ## [0.19.0-alpha.15](https://github.com/dynamic-labs/DynamicAuth/compare/v0.19.0-alpha.14...v0.19.0-alpha.15) (2023-10-11)
3
+
2
4
  ## [0.19.0-alpha.14](https://github.com/dynamic-labs/DynamicAuth/compare/v0.19.0-alpha.13...v0.19.0-alpha.14) (2023-10-10)
3
5
 
4
6
 
package/package.cjs CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var version = "0.19.0-alpha.14";
5
+ var version = "0.19.0-alpha.15";
6
6
  var dependencies = {
7
7
  "@dynamic-labs/iconic": "0.1.34",
8
8
  "@dynamic-labs/sdk-api": "0.0.281",
package/package.js CHANGED
@@ -1,4 +1,4 @@
1
- var version = "0.19.0-alpha.14";
1
+ var version = "0.19.0-alpha.15";
2
2
  var dependencies = {
3
3
  "@dynamic-labs/iconic": "0.1.34",
4
4
  "@dynamic-labs/sdk-api": "0.0.281",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dynamic-labs/sdk-react-core",
3
- "version": "0.19.0-alpha.14",
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.14",
21
- "@dynamic-labs/multi-wallet": "0.19.0-alpha.14",
22
- "@dynamic-labs/rpc-providers": "0.19.0-alpha.14",
23
- "@dynamic-labs/types": "0.19.0-alpha.14",
24
- "@dynamic-labs/utils": "0.19.0-alpha.14",
25
- "@dynamic-labs/wallet-book": "0.19.0-alpha.14",
26
- "@dynamic-labs/wallet-connector-core": "0.19.0-alpha.14",
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: 'Send Transaction', transaction: transaction, handler: handler, onTransactionResponseSuccess: resolve, onReject: reject, provider: provider })));
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: 'Send Transaction', transaction: transaction, handler: handler, onTransactionResponseSuccess: resolve, onReject: reject, provider: provider })));
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
- export declare const transactionErrorMessage: (error: Error & {
1
+ type TransactionError = Error & {
2
2
  code?: string;
3
3
  reason?: string;
4
- }) => string;
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] ||