@dynamic-labs/ethereum-core 5.1.0 → 5.3.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 +26 -0
- package/package.cjs +1 -1
- package/package.js +1 -1
- package/package.json +9 -9
- package/src/utils/viem/interceptTransport/interceptTransport.cjs +1 -1
- package/src/utils/viem/interceptTransport/interceptTransport.d.ts +1 -0
- package/src/utils/viem/interceptTransport/interceptTransport.js +1 -1
- package/src/wallet/EthereumWallet.cjs +53 -2
- package/src/wallet/EthereumWallet.js +54 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,4 +1,30 @@
|
|
|
1
1
|
|
|
2
|
+
## [5.3.0](https://github.com/dynamic-labs/dynamic-auth/compare/v5.2.0...v5.3.0) (2026-08-12)
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
### Features
|
|
6
|
+
|
|
7
|
+
* **screening:** add transaction-screening service, types, and connector wiring (DYNT-1663) ([#12160](https://github.com/dynamic-labs/dynamic-auth/issues/12160)) ([d8df6a1](https://github.com/dynamic-labs/dynamic-auth/commit/d8df6a1fccbb6370c140454d9297eabd97699e35)), closes [#12172](https://github.com/dynamic-labs/dynamic-auth/issues/12172) [#12167](https://github.com/dynamic-labs/dynamic-auth/issues/12167) [#12168](https://github.com/dynamic-labs/dynamic-auth/issues/12168) [#12169](https://github.com/dynamic-labs/dynamic-auth/issues/12169)
|
|
8
|
+
* **screening:** screen Bitcoin connected-wallet transactions (DYNT-1663) ([#12169](https://github.com/dynamic-labs/dynamic-auth/issues/12169)) ([f34d1c3](https://github.com/dynamic-labs/dynamic-auth/commit/f34d1c31fe10d0cb02b4f7462dd4900d0256604a))
|
|
9
|
+
* **screening:** screen EVM connected-wallet sends (DYNT-1663) ([#12167](https://github.com/dynamic-labs/dynamic-auth/issues/12167)) ([1b72b24](https://github.com/dynamic-labs/dynamic-auth/commit/1b72b24393a49153d74ce715a44d262e8e48ddc7))
|
|
10
|
+
* **screening:** screen Solana connected-wallet transactions (DYNT-1663) ([#12168](https://github.com/dynamic-labs/dynamic-auth/issues/12168)) ([000eb18](https://github.com/dynamic-labs/dynamic-auth/commit/000eb180aca8349804953ff7738c0ba984a2fa21))
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
### Bug Fixes
|
|
14
|
+
|
|
15
|
+
* add PhoneNumberAlreadyLinkedError and map duplicate-phone backend code ([#12145](https://github.com/dynamic-labs/dynamic-auth/issues/12145)) ([9d13b5f](https://github.com/dynamic-labs/dynamic-auth/commit/9d13b5f8b22716b4c9ce206ee870aab5bd745b8b))
|
|
16
|
+
* **react-native-extension:** throw clear error when react-native-keychain native module is missing ([#12197](https://github.com/dynamic-labs/dynamic-auth/issues/12197)) ([b9983e1](https://github.com/dynamic-labs/dynamic-auth/commit/b9983e1f1aefa9a9bbdc1435f706a05e64f34f1c))
|
|
17
|
+
* security updates ([#12187](https://github.com/dynamic-labs/dynamic-auth/issues/12187)) ([d3a31e2](https://github.com/dynamic-labs/dynamic-auth/commit/d3a31e23533b6b7739851a3b747d62ba13d318b2))
|
|
18
|
+
* security updates ([#12208](https://github.com/dynamic-labs/dynamic-auth/issues/12208)) ([9e9472a](https://github.com/dynamic-labs/dynamic-auth/commit/9e9472acfbe01f7ac9e160829cc10e53c65f91e7))
|
|
19
|
+
* **sdk-react-core:** avoid spurious WaaS client rebuild on transient user sessionId churn ([#12182](https://github.com/dynamic-labs/dynamic-auth/issues/12182)) ([480b2ec](https://github.com/dynamic-labs/dynamic-auth/commit/480b2ecc87486a852e75e8814a76fb59ffe40c5d))
|
|
20
|
+
|
|
21
|
+
## [5.2.0](https://github.com/dynamic-labs/dynamic-auth/compare/v5.1.0...v5.2.0) (2026-08-06)
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
### Features
|
|
25
|
+
|
|
26
|
+
* **webview-controller:** validate native SDK locale override before applying ([#12155](https://github.com/dynamic-labs/dynamic-auth/issues/12155)) ([4a9e1da](https://github.com/dynamic-labs/dynamic-auth/commit/4a9e1dafb59099c47d3678cc24f8475164c3db59))
|
|
27
|
+
|
|
2
28
|
## [5.1.0](https://github.com/dynamic-labs/dynamic-auth/compare/v5.0.0...v5.1.0) (2026-08-04)
|
|
3
29
|
|
|
4
30
|
|
package/package.cjs
CHANGED
package/package.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dynamic-labs/ethereum-core",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.3.0",
|
|
4
4
|
"description": "Core package for utilities and types for viem",
|
|
5
5
|
"author": "Dynamic Labs, Inc.",
|
|
6
6
|
"license": "MIT",
|
|
@@ -18,14 +18,14 @@
|
|
|
18
18
|
},
|
|
19
19
|
"homepage": "https://www.dynamic.xyz/",
|
|
20
20
|
"dependencies": {
|
|
21
|
-
"@dynamic-labs/sdk-api-core": "0.0.
|
|
22
|
-
"@dynamic-labs/assert-package-version": "5.
|
|
23
|
-
"@dynamic-labs/logger": "5.
|
|
24
|
-
"@dynamic-labs/rpc-providers": "5.
|
|
25
|
-
"@dynamic-labs/types": "5.
|
|
26
|
-
"@dynamic-labs/utils": "5.
|
|
27
|
-
"@dynamic-labs/wallet-book": "5.
|
|
28
|
-
"@dynamic-labs/wallet-connector-core": "5.
|
|
21
|
+
"@dynamic-labs/sdk-api-core": "0.0.1118",
|
|
22
|
+
"@dynamic-labs/assert-package-version": "5.3.0",
|
|
23
|
+
"@dynamic-labs/logger": "5.3.0",
|
|
24
|
+
"@dynamic-labs/rpc-providers": "5.3.0",
|
|
25
|
+
"@dynamic-labs/types": "5.3.0",
|
|
26
|
+
"@dynamic-labs/utils": "5.3.0",
|
|
27
|
+
"@dynamic-labs/wallet-book": "5.3.0",
|
|
28
|
+
"@dynamic-labs/wallet-connector-core": "5.3.0"
|
|
29
29
|
},
|
|
30
30
|
"peerDependencies": {
|
|
31
31
|
"viem": "^2.45.3"
|
|
@@ -65,7 +65,7 @@ const interceptTransport = ({ getAccounts, onPersonalSign, onSendTransaction, on
|
|
|
65
65
|
}
|
|
66
66
|
if (onSendCalls && method === 'wallet_sendCalls') {
|
|
67
67
|
const [callParams] = params;
|
|
68
|
-
return onSendCalls({ callParams, provider });
|
|
68
|
+
return onSendCalls({ args, callParams, provider });
|
|
69
69
|
}
|
|
70
70
|
return provider.request(args);
|
|
71
71
|
}),
|
|
@@ -61,7 +61,7 @@ const interceptTransport = ({ getAccounts, onPersonalSign, onSendTransaction, on
|
|
|
61
61
|
}
|
|
62
62
|
if (onSendCalls && method === 'wallet_sendCalls') {
|
|
63
63
|
const [callParams] = params;
|
|
64
|
-
return onSendCalls({ callParams, provider });
|
|
64
|
+
return onSendCalls({ args, callParams, provider });
|
|
65
65
|
}
|
|
66
66
|
return provider.request(args);
|
|
67
67
|
}),
|
|
@@ -5,6 +5,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
5
5
|
|
|
6
6
|
var _tslib = require('../../_virtual/_tslib.cjs');
|
|
7
7
|
var viem = require('viem');
|
|
8
|
+
var types = require('@dynamic-labs/types');
|
|
8
9
|
var walletConnectorCore = require('@dynamic-labs/wallet-connector-core');
|
|
9
10
|
require('@dynamic-labs/utils');
|
|
10
11
|
var logger = require('../utils/logger.cjs');
|
|
@@ -16,6 +17,23 @@ require('viem/accounts');
|
|
|
16
17
|
var getOrMapViemChain = require('../utils/viem/getOrMapViemChain/getOrMapViemChain.cjs');
|
|
17
18
|
var parseAddress = require('../utils/parseAddress/parseAddress.cjs');
|
|
18
19
|
|
|
20
|
+
/**
|
|
21
|
+
* Resolves the chain a batch is screened against. EIP-5792 carries the target
|
|
22
|
+
* chain in the request itself, so that wins over the connected client's chain.
|
|
23
|
+
* Never throws: screening is fail-open, so an unparseable value degrades to the
|
|
24
|
+
* client's chain rather than failing a send.
|
|
25
|
+
*/
|
|
26
|
+
const screeningChainId = (requestChainId, clientChainId) => {
|
|
27
|
+
try {
|
|
28
|
+
if (requestChainId) {
|
|
29
|
+
return viem.hexToNumber(requestChainId).toString();
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
catch (_a) {
|
|
33
|
+
// Unparseable chain id; fall through to the connected client's chain.
|
|
34
|
+
}
|
|
35
|
+
return clientChainId === null || clientChainId === void 0 ? void 0 : clientChainId.toString();
|
|
36
|
+
};
|
|
19
37
|
class EthereumWallet extends walletConnectorCore.Wallet {
|
|
20
38
|
constructor(props) {
|
|
21
39
|
super(Object.assign(Object.assign({}, props), { address: parseAddress.parseAddress(props.address) }));
|
|
@@ -94,11 +112,44 @@ class EthereumWallet extends walletConnectorCore.Wallet {
|
|
|
94
112
|
yield this.sync();
|
|
95
113
|
return provider.request(args);
|
|
96
114
|
}),
|
|
97
|
-
|
|
115
|
+
onSendCalls: (_b) => _tslib.__awaiter(this, [_b], void 0, function* ({ args, callParams, provider }) {
|
|
116
|
+
var _c;
|
|
117
|
+
yield this.sync();
|
|
118
|
+
const screening = this._connector.transactionScreening;
|
|
119
|
+
if (screening) {
|
|
120
|
+
// Nothing here may throw: a raw wallet_sendCalls can carry
|
|
121
|
+
// anything, and screening is fail-open by contract, so a malformed
|
|
122
|
+
// request must still reach the wallet and get its own RPC error.
|
|
123
|
+
const calls = Array.isArray(callParams === null || callParams === void 0 ? void 0 : callParams.calls)
|
|
124
|
+
? callParams.calls
|
|
125
|
+
: [];
|
|
126
|
+
const chainId = screeningChainId(callParams === null || callParams === void 0 ? void 0 : callParams.chainId, (_c = walletClient.chain) === null || _c === void 0 ? void 0 : _c.id);
|
|
127
|
+
yield Promise.all(calls.map((call) => screening.screenTransaction({
|
|
128
|
+
chain: types.TransactionScreeningChain.EVM,
|
|
129
|
+
chainId,
|
|
130
|
+
context: { evmTransaction: { to: call === null || call === void 0 ? void 0 : call.to } },
|
|
131
|
+
senderAddress: this.address,
|
|
132
|
+
})));
|
|
133
|
+
}
|
|
134
|
+
return provider.request(args);
|
|
135
|
+
}),
|
|
136
|
+
onSendTransaction: (_d) => _tslib.__awaiter(this, [_d], void 0, function* ({ provider, args, transaction }) {
|
|
137
|
+
var _e, _f, _g;
|
|
98
138
|
yield this.sync();
|
|
139
|
+
const screening = this._connector.transactionScreening;
|
|
140
|
+
if (screening) {
|
|
141
|
+
// eth_sendTransaction carries no chain id: the wallet sends on the
|
|
142
|
+
// chain it is currently on, so the client's chain is the target.
|
|
143
|
+
yield screening.screenTransaction({
|
|
144
|
+
chain: types.TransactionScreeningChain.EVM,
|
|
145
|
+
chainId: (_f = (_e = walletClient.chain) === null || _e === void 0 ? void 0 : _e.id) === null || _f === void 0 ? void 0 : _f.toString(),
|
|
146
|
+
context: { evmTransaction: { to: (_g = transaction === null || transaction === void 0 ? void 0 : transaction.to) !== null && _g !== void 0 ? _g : undefined } },
|
|
147
|
+
senderAddress: transaction === null || transaction === void 0 ? void 0 : transaction.from,
|
|
148
|
+
});
|
|
149
|
+
}
|
|
99
150
|
return provider.request(args);
|
|
100
151
|
}),
|
|
101
|
-
onSignTypedData: (
|
|
152
|
+
onSignTypedData: (_h) => _tslib.__awaiter(this, [_h], void 0, function* ({ provider, args }) {
|
|
102
153
|
yield this.sync();
|
|
103
154
|
return provider.request(args);
|
|
104
155
|
}),
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
'use client'
|
|
2
2
|
import { __awaiter } from '../../_virtual/_tslib.js';
|
|
3
|
-
import { getContract, parseUnits, parseEther, createWalletClient, custom } from 'viem';
|
|
3
|
+
import { getContract, parseUnits, parseEther, createWalletClient, custom, hexToNumber } from 'viem';
|
|
4
|
+
import { TransactionScreeningChain } from '@dynamic-labs/types';
|
|
4
5
|
import { Wallet } from '@dynamic-labs/wallet-connector-core';
|
|
5
6
|
import '@dynamic-labs/utils';
|
|
6
7
|
import { logger } from '../utils/logger.js';
|
|
@@ -12,6 +13,23 @@ import 'viem/accounts';
|
|
|
12
13
|
import { getChain } from '../utils/viem/getOrMapViemChain/getOrMapViemChain.js';
|
|
13
14
|
import { parseAddress } from '../utils/parseAddress/parseAddress.js';
|
|
14
15
|
|
|
16
|
+
/**
|
|
17
|
+
* Resolves the chain a batch is screened against. EIP-5792 carries the target
|
|
18
|
+
* chain in the request itself, so that wins over the connected client's chain.
|
|
19
|
+
* Never throws: screening is fail-open, so an unparseable value degrades to the
|
|
20
|
+
* client's chain rather than failing a send.
|
|
21
|
+
*/
|
|
22
|
+
const screeningChainId = (requestChainId, clientChainId) => {
|
|
23
|
+
try {
|
|
24
|
+
if (requestChainId) {
|
|
25
|
+
return hexToNumber(requestChainId).toString();
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
catch (_a) {
|
|
29
|
+
// Unparseable chain id; fall through to the connected client's chain.
|
|
30
|
+
}
|
|
31
|
+
return clientChainId === null || clientChainId === void 0 ? void 0 : clientChainId.toString();
|
|
32
|
+
};
|
|
15
33
|
class EthereumWallet extends Wallet {
|
|
16
34
|
constructor(props) {
|
|
17
35
|
super(Object.assign(Object.assign({}, props), { address: parseAddress(props.address) }));
|
|
@@ -90,11 +108,44 @@ class EthereumWallet extends Wallet {
|
|
|
90
108
|
yield this.sync();
|
|
91
109
|
return provider.request(args);
|
|
92
110
|
}),
|
|
93
|
-
|
|
111
|
+
onSendCalls: (_b) => __awaiter(this, [_b], void 0, function* ({ args, callParams, provider }) {
|
|
112
|
+
var _c;
|
|
113
|
+
yield this.sync();
|
|
114
|
+
const screening = this._connector.transactionScreening;
|
|
115
|
+
if (screening) {
|
|
116
|
+
// Nothing here may throw: a raw wallet_sendCalls can carry
|
|
117
|
+
// anything, and screening is fail-open by contract, so a malformed
|
|
118
|
+
// request must still reach the wallet and get its own RPC error.
|
|
119
|
+
const calls = Array.isArray(callParams === null || callParams === void 0 ? void 0 : callParams.calls)
|
|
120
|
+
? callParams.calls
|
|
121
|
+
: [];
|
|
122
|
+
const chainId = screeningChainId(callParams === null || callParams === void 0 ? void 0 : callParams.chainId, (_c = walletClient.chain) === null || _c === void 0 ? void 0 : _c.id);
|
|
123
|
+
yield Promise.all(calls.map((call) => screening.screenTransaction({
|
|
124
|
+
chain: TransactionScreeningChain.EVM,
|
|
125
|
+
chainId,
|
|
126
|
+
context: { evmTransaction: { to: call === null || call === void 0 ? void 0 : call.to } },
|
|
127
|
+
senderAddress: this.address,
|
|
128
|
+
})));
|
|
129
|
+
}
|
|
130
|
+
return provider.request(args);
|
|
131
|
+
}),
|
|
132
|
+
onSendTransaction: (_d) => __awaiter(this, [_d], void 0, function* ({ provider, args, transaction }) {
|
|
133
|
+
var _e, _f, _g;
|
|
94
134
|
yield this.sync();
|
|
135
|
+
const screening = this._connector.transactionScreening;
|
|
136
|
+
if (screening) {
|
|
137
|
+
// eth_sendTransaction carries no chain id: the wallet sends on the
|
|
138
|
+
// chain it is currently on, so the client's chain is the target.
|
|
139
|
+
yield screening.screenTransaction({
|
|
140
|
+
chain: TransactionScreeningChain.EVM,
|
|
141
|
+
chainId: (_f = (_e = walletClient.chain) === null || _e === void 0 ? void 0 : _e.id) === null || _f === void 0 ? void 0 : _f.toString(),
|
|
142
|
+
context: { evmTransaction: { to: (_g = transaction === null || transaction === void 0 ? void 0 : transaction.to) !== null && _g !== void 0 ? _g : undefined } },
|
|
143
|
+
senderAddress: transaction === null || transaction === void 0 ? void 0 : transaction.from,
|
|
144
|
+
});
|
|
145
|
+
}
|
|
95
146
|
return provider.request(args);
|
|
96
147
|
}),
|
|
97
|
-
onSignTypedData: (
|
|
148
|
+
onSignTypedData: (_h) => __awaiter(this, [_h], void 0, function* ({ provider, args }) {
|
|
98
149
|
yield this.sync();
|
|
99
150
|
return provider.request(args);
|
|
100
151
|
}),
|