@dynamic-labs/ethereum-core 3.0.0-alpha.60 → 3.0.0-alpha.62

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,13 @@
1
1
 
2
+ ## [3.0.0-alpha.62](https://github.com/dynamic-labs/DynamicAuth/compare/v3.0.0-alpha.61...v3.0.0-alpha.62) (2024-09-08)
3
+
4
+
5
+ ### Bug Fixes
6
+
7
+ * fiat not displaying ([#6825](https://github.com/dynamic-labs/DynamicAuth/issues/6825)) ([a76a14d](https://github.com/dynamic-labs/DynamicAuth/commit/a76a14dfb10d44b15b406995122c080961546728))
8
+
9
+ ## [3.0.0-alpha.61](https://github.com/dynamic-labs/DynamicAuth/compare/v3.0.0-alpha.60...v3.0.0-alpha.61) (2024-09-06)
10
+
2
11
  ## [3.0.0-alpha.60](https://github.com/dynamic-labs/DynamicAuth/compare/v3.0.0-alpha.59...v3.0.0-alpha.60) (2024-09-05)
3
12
 
4
13
  ## [3.0.0-alpha.59](https://github.com/dynamic-labs/DynamicAuth/compare/v3.0.0-alpha.58...v3.0.0-alpha.59) (2024-09-05)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dynamic-labs/ethereum-core",
3
- "version": "3.0.0-alpha.60",
3
+ "version": "3.0.0-alpha.62",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/dynamic-labs/dynamic-auth.git",
@@ -30,11 +30,11 @@
30
30
  },
31
31
  "peerDependencies": {
32
32
  "viem": "^2.7.6",
33
- "@dynamic-labs/logger": "3.0.0-alpha.60",
34
- "@dynamic-labs/rpc-providers": "3.0.0-alpha.60",
35
- "@dynamic-labs/types": "3.0.0-alpha.60",
36
- "@dynamic-labs/utils": "3.0.0-alpha.60",
37
- "@dynamic-labs/wallet-book": "3.0.0-alpha.60",
38
- "@dynamic-labs/wallet-connector-core": "3.0.0-alpha.60"
33
+ "@dynamic-labs/logger": "3.0.0-alpha.62",
34
+ "@dynamic-labs/rpc-providers": "3.0.0-alpha.62",
35
+ "@dynamic-labs/types": "3.0.0-alpha.62",
36
+ "@dynamic-labs/utils": "3.0.0-alpha.62",
37
+ "@dynamic-labs/wallet-book": "3.0.0-alpha.62",
38
+ "@dynamic-labs/wallet-connector-core": "3.0.0-alpha.62"
39
39
  }
40
40
  }
@@ -164,7 +164,7 @@ class EthWalletConnector extends walletConnectorCore.WalletConnectorBase {
164
164
  let addresses = [];
165
165
  // some wallets like MM and Phantom won't return the selected account if
166
166
  // it's not connected to the dapp, and the only way we can prompt for a connection in MM
167
- // is by calling requestPermissions, which wil allow the user to choose the accounts to connect
167
+ // is by calling requestPermissions, which will allow the user to choose the accounts to connect
168
168
  if (options === null || options === void 0 ? void 0 : options.chooseAccounts) {
169
169
  addresses = yield this.chooseAccountsToConnect();
170
170
  walletConnectorCore.logger.debug('getConnectedAccounts - Chosen addresses', addresses);
@@ -160,7 +160,7 @@ class EthWalletConnector extends WalletConnectorBase {
160
160
  let addresses = [];
161
161
  // some wallets like MM and Phantom won't return the selected account if
162
162
  // it's not connected to the dapp, and the only way we can prompt for a connection in MM
163
- // is by calling requestPermissions, which wil allow the user to choose the accounts to connect
163
+ // is by calling requestPermissions, which will allow the user to choose the accounts to connect
164
164
  if (options === null || options === void 0 ? void 0 : options.chooseAccounts) {
165
165
  addresses = yield this.chooseAccountsToConnect();
166
166
  logger.debug('getConnectedAccounts - Chosen addresses', addresses);
@@ -6,6 +6,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
6
6
  var _tslib = require('../../../../_virtual/_tslib.cjs');
7
7
  var viem = require('viem');
8
8
  var utils = require('@dynamic-labs/utils');
9
+ var isTransactionExecutionError = require('../isTransactionExecutionError/isTransactionExecutionError.cjs');
9
10
 
10
11
  const interceptTransport = ({ getAccounts, onPersonalSign, onSendTransaction, onSignTypedData, transport, }) => (props) => {
11
12
  const provider = transport(props);
@@ -28,6 +29,10 @@ const interceptTransport = ({ getAccounts, onPersonalSign, onSendTransaction, on
28
29
  if (onSendTransaction && method === 'eth_sendTransaction') {
29
30
  const [transaction] = params;
30
31
  return onSendTransaction({ args, provider, transaction }).catch((error) => {
32
+ if (isTransactionExecutionError.isTransactionExecutionError(error) &&
33
+ error.walk() instanceof utils.UserRejectedTransactionError) {
34
+ throw new viem.UserRejectedRequestError(error.walk());
35
+ }
31
36
  if (error instanceof utils.UserRejectedRequestError) {
32
37
  throw new viem.UserRejectedRequestError(error);
33
38
  }
@@ -1,7 +1,8 @@
1
1
  'use client'
2
2
  import { __awaiter } from '../../../../_virtual/_tslib.js';
3
3
  import { custom, UserRejectedRequestError as UserRejectedRequestError$1 } from 'viem';
4
- import { UserRejectedRequestError } from '@dynamic-labs/utils';
4
+ import { UserRejectedRequestError, UserRejectedTransactionError } from '@dynamic-labs/utils';
5
+ import { isTransactionExecutionError } from '../isTransactionExecutionError/isTransactionExecutionError.js';
5
6
 
6
7
  const interceptTransport = ({ getAccounts, onPersonalSign, onSendTransaction, onSignTypedData, transport, }) => (props) => {
7
8
  const provider = transport(props);
@@ -24,6 +25,10 @@ const interceptTransport = ({ getAccounts, onPersonalSign, onSendTransaction, on
24
25
  if (onSendTransaction && method === 'eth_sendTransaction') {
25
26
  const [transaction] = params;
26
27
  return onSendTransaction({ args, provider, transaction }).catch((error) => {
28
+ if (isTransactionExecutionError(error) &&
29
+ error.walk() instanceof UserRejectedTransactionError) {
30
+ throw new UserRejectedRequestError$1(error.walk());
31
+ }
27
32
  if (error instanceof UserRejectedRequestError) {
28
33
  throw new UserRejectedRequestError$1(error);
29
34
  }
@@ -0,0 +1 @@
1
+ export { isTransactionExecutionError } from './isTransactionExecutionError';
@@ -0,0 +1,16 @@
1
+ 'use client'
2
+ 'use strict';
3
+
4
+ Object.defineProperty(exports, '__esModule', { value: true });
5
+
6
+ /**
7
+ * @description
8
+ * Checks if the error has a `walk` method
9
+ */
10
+ const isTransactionExecutionError = (error) => error !== undefined &&
11
+ error !== null &&
12
+ typeof error === 'object' &&
13
+ 'walk' in error &&
14
+ typeof error['walk'] === 'function';
15
+
16
+ exports.isTransactionExecutionError = isTransactionExecutionError;
@@ -0,0 +1,7 @@
1
+ /**
2
+ * @description
3
+ * Checks if the error has a `walk` method
4
+ */
5
+ export declare const isTransactionExecutionError: <T>(error: unknown) => error is {
6
+ walk: () => T;
7
+ };
@@ -0,0 +1,12 @@
1
+ 'use client'
2
+ /**
3
+ * @description
4
+ * Checks if the error has a `walk` method
5
+ */
6
+ const isTransactionExecutionError = (error) => error !== undefined &&
7
+ error !== null &&
8
+ typeof error === 'object' &&
9
+ 'walk' in error &&
10
+ typeof error['walk'] === 'function';
11
+
12
+ export { isTransactionExecutionError };