@dynamic-labs/ethereum 4.18.8 → 4.19.1
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 +23 -0
- package/package.cjs +1 -1
- package/package.js +1 -1
- package/package.json +10 -10
- package/src/ethProviderHelper.cjs +1 -2
- package/src/ethProviderHelper.js +1 -2
- package/src/walletConnect/WalletConnectConnector/WalletConnectConnector.cjs +1 -2
- package/src/walletConnect/WalletConnectConnector/WalletConnectConnector.js +1 -2
- package/src/utils/normalizeRpcError/index.d.ts +0 -1
- package/src/utils/normalizeRpcError/normalizeRpcError.cjs +0 -51
- package/src/utils/normalizeRpcError/normalizeRpcError.d.ts +0 -5
- package/src/utils/normalizeRpcError/normalizeRpcError.js +0 -47
package/CHANGELOG.md
CHANGED
|
@@ -1,4 +1,27 @@
|
|
|
1
1
|
|
|
2
|
+
### [4.19.1](https://github.com/dynamic-labs/dynamic-auth/compare/v4.19.0...v4.19.1) (2025-05-26)
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
### Bug Fixes
|
|
6
|
+
|
|
7
|
+
* **react-native:** reload webview when disconnected ([#8765](https://github.com/dynamic-labs/dynamic-auth/issues/8765)) ([addf90b](https://github.com/dynamic-labs/dynamic-auth/commit/addf90b6fccbe4b883e9778cf7a07e0471f85318))
|
|
8
|
+
|
|
9
|
+
## [4.19.0](https://github.com/dynamic-labs/dynamic-auth/compare/v4.18.8...v4.19.0) (2025-05-23)
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
### Features
|
|
13
|
+
|
|
14
|
+
* expose 7702 kernel and add viem controller ([#8786](https://github.com/dynamic-labs/dynamic-auth/issues/8786)) ([eea710e](https://github.com/dynamic-labs/dynamic-auth/commit/eea710e238ccbc36e6be37d8f7493954b99858ef))
|
|
15
|
+
* use browser wallet client & iframe for waas operations ([#8697](https://github.com/dynamic-labs/dynamic-auth/issues/8697)) ([13a47b1](https://github.com/dynamic-labs/dynamic-auth/commit/13a47b1c9a2984f08682e833ca8c87605a3a872f))
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
### Bug Fixes
|
|
19
|
+
|
|
20
|
+
* **global-wallet:** close popup when page unloads to prevent orphaned popup windows ([#8787](https://github.com/dynamic-labs/dynamic-auth/issues/8787)) ([441b04c](https://github.com/dynamic-labs/dynamic-auth/commit/441b04ca04a02feb37473e43bca0e66c5d772ce2))
|
|
21
|
+
* override network when requesting BTC networks in useTokenBalances ([#8773](https://github.com/dynamic-labs/dynamic-auth/issues/8773)) ([fd07d09](https://github.com/dynamic-labs/dynamic-auth/commit/fd07d09de970c7e6f85b251a88854e8eca57e249))
|
|
22
|
+
* remove libmpc executor dependency global wallet ([#8792](https://github.com/dynamic-labs/dynamic-auth/issues/8792)) ([7502585](https://github.com/dynamic-labs/dynamic-auth/commit/75025859d2f952915322cf65504117ec2506152b))
|
|
23
|
+
* standardize font on headers ([#8734](https://github.com/dynamic-labs/dynamic-auth/issues/8734)) ([9f0900c](https://github.com/dynamic-labs/dynamic-auth/commit/9f0900cb7c4294201cc952ae7538648bdea83ff5))
|
|
24
|
+
|
|
2
25
|
### [4.18.8](https://github.com/dynamic-labs/dynamic-auth/compare/v4.18.7...v4.18.8) (2025-05-22)
|
|
3
26
|
|
|
4
27
|
### Bug Fixes
|
package/package.cjs
CHANGED
package/package.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dynamic-labs/ethereum",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.19.1",
|
|
4
4
|
"description": "A React SDK for implementing wallet web3 authentication and authorization to your website.",
|
|
5
5
|
"author": "Dynamic Labs, Inc.",
|
|
6
6
|
"license": "MIT",
|
|
@@ -23,15 +23,15 @@
|
|
|
23
23
|
"eventemitter3": "5.0.1",
|
|
24
24
|
"buffer": "6.0.3",
|
|
25
25
|
"@metamask/sdk": "0.33.0",
|
|
26
|
-
"@dynamic-labs/assert-package-version": "4.
|
|
27
|
-
"@dynamic-labs/embedded-wallet-evm": "4.
|
|
28
|
-
"@dynamic-labs/ethereum-core": "4.
|
|
29
|
-
"@dynamic-labs/logger": "4.
|
|
30
|
-
"@dynamic-labs/rpc-providers": "4.
|
|
31
|
-
"@dynamic-labs/types": "4.
|
|
32
|
-
"@dynamic-labs/utils": "4.
|
|
33
|
-
"@dynamic-labs/wallet-book": "4.
|
|
34
|
-
"@dynamic-labs/wallet-connector-core": "4.
|
|
26
|
+
"@dynamic-labs/assert-package-version": "4.19.1",
|
|
27
|
+
"@dynamic-labs/embedded-wallet-evm": "4.19.1",
|
|
28
|
+
"@dynamic-labs/ethereum-core": "4.19.1",
|
|
29
|
+
"@dynamic-labs/logger": "4.19.1",
|
|
30
|
+
"@dynamic-labs/rpc-providers": "4.19.1",
|
|
31
|
+
"@dynamic-labs/types": "4.19.1",
|
|
32
|
+
"@dynamic-labs/utils": "4.19.1",
|
|
33
|
+
"@dynamic-labs/wallet-book": "4.19.1",
|
|
34
|
+
"@dynamic-labs/wallet-connector-core": "4.19.1"
|
|
35
35
|
},
|
|
36
36
|
"peerDependencies": {
|
|
37
37
|
"viem": "^2.28.4"
|
|
@@ -9,7 +9,6 @@ var walletConnectorCore = require('@dynamic-labs/wallet-connector-core');
|
|
|
9
9
|
var walletBook = require('@dynamic-labs/wallet-book');
|
|
10
10
|
var utils = require('@dynamic-labs/utils');
|
|
11
11
|
var ethereumCore = require('@dynamic-labs/ethereum-core');
|
|
12
|
-
var normalizeRpcError = require('./utils/normalizeRpcError/normalizeRpcError.cjs');
|
|
13
12
|
|
|
14
13
|
class EthProviderHelper {
|
|
15
14
|
constructor(connector) {
|
|
@@ -89,7 +88,7 @@ class EthProviderHelper {
|
|
|
89
88
|
account: this.connector.getActiveAccount(),
|
|
90
89
|
chain: chainId ? ethereumCore.chainsMap[chainId] : this.connector.getActiveChain(),
|
|
91
90
|
transport: viem.custom({
|
|
92
|
-
request: (args) => provider.request(args).catch(
|
|
91
|
+
request: (args) => provider.request(args).catch(ethereumCore.normalizeRpcError),
|
|
93
92
|
}, this.connector.providersConfig.httpTransportConfig),
|
|
94
93
|
});
|
|
95
94
|
}
|
package/src/ethProviderHelper.js
CHANGED
|
@@ -4,8 +4,7 @@ import { createWalletClient, custom, getAddress } from 'viem';
|
|
|
4
4
|
import { ProviderLookup, logger, eventListenerHandlers } from '@dynamic-labs/wallet-connector-core';
|
|
5
5
|
import { findWalletBookWallet } from '@dynamic-labs/wallet-book';
|
|
6
6
|
import { getProvidersFromWindow, Eip6963ProviderSingleton } from '@dynamic-labs/utils';
|
|
7
|
-
import { chainsMap } from '@dynamic-labs/ethereum-core';
|
|
8
|
-
import { normalizeRpcError } from './utils/normalizeRpcError/normalizeRpcError.js';
|
|
7
|
+
import { chainsMap, normalizeRpcError } from '@dynamic-labs/ethereum-core';
|
|
9
8
|
|
|
10
9
|
class EthProviderHelper {
|
|
11
10
|
constructor(connector) {
|
|
@@ -9,7 +9,6 @@ var accounts = require('viem/accounts');
|
|
|
9
9
|
var ethereumCore = require('@dynamic-labs/ethereum-core');
|
|
10
10
|
var utils = require('@dynamic-labs/utils');
|
|
11
11
|
var walletConnectorCore = require('@dynamic-labs/wallet-connector-core');
|
|
12
|
-
var normalizeRpcError = require('../../utils/normalizeRpcError/normalizeRpcError.cjs');
|
|
13
12
|
var WalletConnectProvider = require('../WalletConnectProvider/WalletConnectProvider.cjs');
|
|
14
13
|
|
|
15
14
|
const WC_CURRENT_CHAIN_KEY = 'dynamic-wc2-current-chain';
|
|
@@ -122,7 +121,7 @@ class WalletConnectConnector extends ethereumCore.EthereumWalletConnector {
|
|
|
122
121
|
transport: viem.custom({
|
|
123
122
|
request: (args) => {
|
|
124
123
|
this.deepLinkIfApplicable(args.method);
|
|
125
|
-
return provider.request(args).catch(
|
|
124
|
+
return provider.request(args).catch(ethereumCore.normalizeRpcError);
|
|
126
125
|
},
|
|
127
126
|
}, this.providersConfig.httpTransportConfig),
|
|
128
127
|
});
|
|
@@ -2,10 +2,9 @@
|
|
|
2
2
|
import { __awaiter } from '../../../_virtual/_tslib.js';
|
|
3
3
|
import { createWalletClient, custom } from 'viem';
|
|
4
4
|
import { toAccount } from 'viem/accounts';
|
|
5
|
-
import { EthereumWalletConnector, chainsMap } from '@dynamic-labs/ethereum-core';
|
|
5
|
+
import { EthereumWalletConnector, chainsMap, normalizeRpcError } from '@dynamic-labs/ethereum-core';
|
|
6
6
|
import { StorageService, parseIntSafe, DynamicError, isMobile, PlatformService } from '@dynamic-labs/utils';
|
|
7
7
|
import { logger, getDeepLink } from '@dynamic-labs/wallet-connector-core';
|
|
8
|
-
import { normalizeRpcError } from '../../utils/normalizeRpcError/normalizeRpcError.js';
|
|
9
8
|
import { WalletConnectProvider } from '../WalletConnectProvider/WalletConnectProvider.js';
|
|
10
9
|
|
|
11
10
|
const WC_CURRENT_CHAIN_KEY = 'dynamic-wc2-current-chain';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { normalizeRpcError } from './normalizeRpcError';
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
'use client'
|
|
2
|
-
'use strict';
|
|
3
|
-
|
|
4
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
5
|
-
|
|
6
|
-
var viem = require('viem');
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* Some wallets may not reject some operations following the EIP-1193 standard.
|
|
10
|
-
* This function normalizes the errors to follow the EIP-1193 standard.
|
|
11
|
-
*/
|
|
12
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
13
|
-
const normalizeRpcError = (err) => {
|
|
14
|
-
/**
|
|
15
|
-
* When the error already comply with the EIP-1193 standard, we don't need to normalize it
|
|
16
|
-
*/
|
|
17
|
-
if (err.code === 4001) {
|
|
18
|
-
throw err;
|
|
19
|
-
}
|
|
20
|
-
let mappedError = null;
|
|
21
|
-
try {
|
|
22
|
-
mappedError = mapRpcError(err);
|
|
23
|
-
}
|
|
24
|
-
catch (e) {
|
|
25
|
-
// ignore errors when mapping
|
|
26
|
-
}
|
|
27
|
-
if (mappedError) {
|
|
28
|
-
throw mappedError;
|
|
29
|
-
}
|
|
30
|
-
/**
|
|
31
|
-
* If no error is mapped, we rethrow the original error
|
|
32
|
-
*/
|
|
33
|
-
throw err;
|
|
34
|
-
};
|
|
35
|
-
const mapRpcError = (err) => {
|
|
36
|
-
/**
|
|
37
|
-
* Checks for user rejection error message
|
|
38
|
-
* Rainbow Extension will return a message like "User rejected the request"
|
|
39
|
-
* BitGet will return a message like "user reject this request"
|
|
40
|
-
* Keplr will return a message that matches "Request rejected"
|
|
41
|
-
*/
|
|
42
|
-
if (typeof err.message === 'string' &&
|
|
43
|
-
(err.message.includes('User rejected the request') ||
|
|
44
|
-
err.message.includes('user reject this request') ||
|
|
45
|
-
err.message === 'Request rejected')) {
|
|
46
|
-
return new viem.UserRejectedRequestError(err);
|
|
47
|
-
}
|
|
48
|
-
return null;
|
|
49
|
-
};
|
|
50
|
-
|
|
51
|
-
exports.normalizeRpcError = normalizeRpcError;
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
'use client'
|
|
2
|
-
import { UserRejectedRequestError } from 'viem';
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* Some wallets may not reject some operations following the EIP-1193 standard.
|
|
6
|
-
* This function normalizes the errors to follow the EIP-1193 standard.
|
|
7
|
-
*/
|
|
8
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
9
|
-
const normalizeRpcError = (err) => {
|
|
10
|
-
/**
|
|
11
|
-
* When the error already comply with the EIP-1193 standard, we don't need to normalize it
|
|
12
|
-
*/
|
|
13
|
-
if (err.code === 4001) {
|
|
14
|
-
throw err;
|
|
15
|
-
}
|
|
16
|
-
let mappedError = null;
|
|
17
|
-
try {
|
|
18
|
-
mappedError = mapRpcError(err);
|
|
19
|
-
}
|
|
20
|
-
catch (e) {
|
|
21
|
-
// ignore errors when mapping
|
|
22
|
-
}
|
|
23
|
-
if (mappedError) {
|
|
24
|
-
throw mappedError;
|
|
25
|
-
}
|
|
26
|
-
/**
|
|
27
|
-
* If no error is mapped, we rethrow the original error
|
|
28
|
-
*/
|
|
29
|
-
throw err;
|
|
30
|
-
};
|
|
31
|
-
const mapRpcError = (err) => {
|
|
32
|
-
/**
|
|
33
|
-
* Checks for user rejection error message
|
|
34
|
-
* Rainbow Extension will return a message like "User rejected the request"
|
|
35
|
-
* BitGet will return a message like "user reject this request"
|
|
36
|
-
* Keplr will return a message that matches "Request rejected"
|
|
37
|
-
*/
|
|
38
|
-
if (typeof err.message === 'string' &&
|
|
39
|
-
(err.message.includes('User rejected the request') ||
|
|
40
|
-
err.message.includes('user reject this request') ||
|
|
41
|
-
err.message === 'Request rejected')) {
|
|
42
|
-
return new UserRejectedRequestError(err);
|
|
43
|
-
}
|
|
44
|
-
return null;
|
|
45
|
-
};
|
|
46
|
-
|
|
47
|
-
export { normalizeRpcError };
|