@dynamic-labs/ethereum-core 4.18.3 → 4.18.5
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 +16 -0
- package/package.cjs +1 -1
- package/package.js +1 -1
- package/package.json +9 -9
- package/src/connector/EthereumWalletConnector.cjs +10 -3
- package/src/connector/EthereumWalletConnector.d.ts +8 -2
- package/src/connector/EthereumWalletConnector.js +10 -3
- package/src/utils/viem/interceptTransport/interceptTransport.cjs +8 -1
- package/src/utils/viem/interceptTransport/interceptTransport.d.ts +9 -2
- package/src/utils/viem/interceptTransport/interceptTransport.js +8 -1
- package/src/wallet/EthereumWallet.cjs +9 -5
- package/src/wallet/EthereumWallet.d.ts +2 -2
- package/src/wallet/EthereumWallet.js +9 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,4 +1,20 @@
|
|
|
1
1
|
|
|
2
|
+
### [4.18.5](https://github.com/dynamic-labs/dynamic-auth/compare/v4.18.4...v4.18.5) (2025-05-15)
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
### Features
|
|
6
|
+
|
|
7
|
+
* add support for external wallet login in global wallet ([#8673](https://github.com/dynamic-labs/dynamic-auth/issues/8673)) ([098b87e](https://github.com/dynamic-labs/dynamic-auth/commit/098b87ea2d588c1808a587fb831b31f47d34c990))
|
|
8
|
+
|
|
9
|
+
### [4.18.4](https://github.com/dynamic-labs/dynamic-auth/compare/v4.18.3...v4.18.4) (2025-05-15)
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
### Bug Fixes
|
|
13
|
+
|
|
14
|
+
* global connectivity confirmation UI should be forced ([#8658](https://github.com/dynamic-labs/dynamic-auth/issues/8658)) ([b1f437b](https://github.com/dynamic-labs/dynamic-auth/commit/b1f437b40ef748db765dac76687abd8d2668a79d))
|
|
15
|
+
* onekey typo ([#8698](https://github.com/dynamic-labs/dynamic-auth/issues/8698)) ([b1f21bf](https://github.com/dynamic-labs/dynamic-auth/commit/b1f21bfacdb42ccbb68bff5e2dd398308fc3d4c3))
|
|
16
|
+
* use correct chain kernel client for AA SIWE ([#8657](https://github.com/dynamic-labs/dynamic-auth/issues/8657)) ([6dfd677](https://github.com/dynamic-labs/dynamic-auth/commit/6dfd677d804fc40994a5be6b696e6e199ada82d4))
|
|
17
|
+
|
|
2
18
|
### [4.18.3](https://github.com/dynamic-labs/dynamic-auth/compare/v4.18.2...v4.18.3) (2025-05-12)
|
|
3
19
|
|
|
4
20
|
### [4.18.2](https://github.com/dynamic-labs/dynamic-auth/compare/v4.18.1...v4.18.2) (2025-05-09)
|
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": "4.18.
|
|
3
|
+
"version": "4.18.5",
|
|
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": "4.18.
|
|
23
|
-
"@dynamic-labs/logger": "4.18.
|
|
24
|
-
"@dynamic-labs/rpc-providers": "4.18.
|
|
25
|
-
"@dynamic-labs/types": "4.18.
|
|
26
|
-
"@dynamic-labs/utils": "4.18.
|
|
27
|
-
"@dynamic-labs/wallet-book": "4.18.
|
|
28
|
-
"@dynamic-labs/wallet-connector-core": "4.18.
|
|
21
|
+
"@dynamic-labs/sdk-api-core": "0.0.667",
|
|
22
|
+
"@dynamic-labs/assert-package-version": "4.18.5",
|
|
23
|
+
"@dynamic-labs/logger": "4.18.5",
|
|
24
|
+
"@dynamic-labs/rpc-providers": "4.18.5",
|
|
25
|
+
"@dynamic-labs/types": "4.18.5",
|
|
26
|
+
"@dynamic-labs/utils": "4.18.5",
|
|
27
|
+
"@dynamic-labs/wallet-book": "4.18.5",
|
|
28
|
+
"@dynamic-labs/wallet-connector-core": "4.18.5"
|
|
29
29
|
},
|
|
30
30
|
"peerDependencies": {
|
|
31
31
|
"viem": "^2.21.60"
|
|
@@ -6,7 +6,6 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
6
6
|
var _tslib = require('../../_virtual/_tslib.cjs');
|
|
7
7
|
var viem = require('viem');
|
|
8
8
|
var accounts = require('viem/accounts');
|
|
9
|
-
var experimental = require('viem/experimental');
|
|
10
9
|
var utils = require('@dynamic-labs/utils');
|
|
11
10
|
var walletConnectorCore = require('@dynamic-labs/wallet-connector-core');
|
|
12
11
|
require('../utils/logger.cjs');
|
|
@@ -316,7 +315,7 @@ class EthereumWalletConnector extends walletConnectorCore.WalletConnectorBase {
|
|
|
316
315
|
if (!walletClient) {
|
|
317
316
|
return false;
|
|
318
317
|
}
|
|
319
|
-
const capabilities = yield
|
|
318
|
+
const capabilities = yield walletClient.getCapabilities();
|
|
320
319
|
const chainIdToCheck = chainId !== null && chainId !== void 0 ? chainId : (yield walletClient.getChainId());
|
|
321
320
|
walletConnectorCore.logger.debug('[EthereumWalletConnector] isAtomicSupported', {
|
|
322
321
|
capabilities,
|
|
@@ -331,7 +330,7 @@ class EthereumWalletConnector extends walletConnectorCore.WalletConnectorBase {
|
|
|
331
330
|
if (!walletClient) {
|
|
332
331
|
return false;
|
|
333
332
|
}
|
|
334
|
-
const capabilities = yield
|
|
333
|
+
const capabilities = yield walletClient.getCapabilities();
|
|
335
334
|
const chainIdToCheck = chainId !== null && chainId !== void 0 ? chainId : (yield walletClient.getChainId());
|
|
336
335
|
walletConnectorCore.logger.debug('[EthereumWalletConnector] isPaymasterServiceSupported', {
|
|
337
336
|
capabilities,
|
|
@@ -340,6 +339,14 @@ class EthereumWalletConnector extends walletConnectorCore.WalletConnectorBase {
|
|
|
340
339
|
return hasPaymasterServiceCapability.hasPaymasterServiceCapability(capabilities, chainIdToCheck);
|
|
341
340
|
});
|
|
342
341
|
}
|
|
342
|
+
/**
|
|
343
|
+
* Whether the wallet supports sign authorization for eip-7702.
|
|
344
|
+
*
|
|
345
|
+
* @returns {boolean} Whether the wallet supports sign authorization
|
|
346
|
+
*/
|
|
347
|
+
isSignAuthorizationSupported() {
|
|
348
|
+
return false;
|
|
349
|
+
}
|
|
343
350
|
}
|
|
344
351
|
|
|
345
352
|
exports.EthereumWalletConnector = EthereumWalletConnector;
|
|
@@ -123,7 +123,7 @@ export declare abstract class EthereumWalletConnector extends WalletConnectorBas
|
|
|
123
123
|
}>, number>)[K]; } : never>;
|
|
124
124
|
getChainId: () => Promise<number>;
|
|
125
125
|
getPermissions: () => Promise<import("viem").GetPermissionsReturnType>;
|
|
126
|
-
prepareAuthorization: (parameters: import("viem/
|
|
126
|
+
prepareAuthorization: (parameters: import("node_modules/viem/_types/actions/wallet/prepareAuthorization").PrepareAuthorizationParameters<Account>) => Promise<import("node_modules/viem/_types/actions/wallet/prepareAuthorization").PrepareAuthorizationReturnType>;
|
|
127
127
|
prepareTransactionRequest: <const request extends import("viem").PrepareTransactionRequestRequest<ViemChain, chainOverride_1>, chainOverride_1 extends ViemChain | undefined = undefined, accountOverride extends `0x${string}` | Account | undefined = undefined>(args: import("viem").PrepareTransactionRequestParameters<ViemChain, Account, chainOverride_1, accountOverride, request>) => Promise<import("viem").UnionRequiredBy<Extract<import("viem").UnionOmit<import("viem").ExtractChainFormatterParameters<import("viem").DeriveChain<ViemChain, chainOverride_1>, "transactionRequest", import("viem").TransactionRequest>, "from"> & (import("viem").DeriveChain<ViemChain, chainOverride_1> extends infer T_15 ? T_15 extends import("viem").DeriveChain<ViemChain, chainOverride_1> ? T_15 extends ViemChain ? {
|
|
128
128
|
chain: T_15;
|
|
129
129
|
} : {
|
|
@@ -6643,7 +6643,7 @@ export declare abstract class EthereumWalletConnector extends WalletConnectorBas
|
|
|
6643
6643
|
sendRawTransaction: (args: import("viem").SendRawTransactionParameters) => Promise<`0x${string}`>;
|
|
6644
6644
|
sendTransaction: <const request_1 extends import("viem").SendTransactionRequest<ViemChain, chainOverride_3>, chainOverride_3 extends ViemChain | undefined = undefined>(args: import("viem").SendTransactionParameters<ViemChain, Account, chainOverride_3, request_1>) => Promise<`0x${string}`>;
|
|
6645
6645
|
showCallsStatus: (parameters: import("viem").ShowCallsStatusParameters) => Promise<void>;
|
|
6646
|
-
signAuthorization: (parameters: import("viem/
|
|
6646
|
+
signAuthorization: (parameters: import("node_modules/viem/_types/actions/wallet/signAuthorization").SignAuthorizationParameters<Account>) => Promise<import("node_modules/viem/_types/actions/wallet/signAuthorization").SignAuthorizationReturnType>;
|
|
6647
6647
|
signMessage: (args: import("viem").SignMessageParameters<Account>) => Promise<`0x${string}`>;
|
|
6648
6648
|
signTransaction: <chainOverride_4 extends ViemChain | undefined, const request_2 extends import("viem").UnionOmit<import("viem").ExtractChainFormatterParameters<import("viem").DeriveChain<ViemChain, chainOverride_4>, "transactionRequest", import("viem").TransactionRequest>, "from"> = import("viem").UnionOmit<import("viem").ExtractChainFormatterParameters<import("viem").DeriveChain<ViemChain, chainOverride_4>, "transactionRequest", import("viem").TransactionRequest>, "from">>(args: import("viem").SignTransactionParameters<ViemChain, Account, chainOverride_4, request_2>) => Promise<import("viem").TransactionSerialized<import("viem").GetTransactionType<request_2, (request_2 extends {
|
|
6649
6649
|
accessList?: undefined;
|
|
@@ -7802,5 +7802,11 @@ export declare abstract class EthereumWalletConnector extends WalletConnectorBas
|
|
|
7802
7802
|
getEnabledNetworks(): GenericNetwork[];
|
|
7803
7803
|
isAtomicSupported(chainId?: number): Promise<boolean>;
|
|
7804
7804
|
isPaymasterServiceSupported(chainId?: number): Promise<boolean>;
|
|
7805
|
+
/**
|
|
7806
|
+
* Whether the wallet supports sign authorization for eip-7702.
|
|
7807
|
+
*
|
|
7808
|
+
* @returns {boolean} Whether the wallet supports sign authorization
|
|
7809
|
+
*/
|
|
7810
|
+
isSignAuthorizationSupported(): boolean;
|
|
7805
7811
|
}
|
|
7806
7812
|
export {};
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
import { __awaiter } from '../../_virtual/_tslib.js';
|
|
3
3
|
import { getAddress, formatEther } from 'viem';
|
|
4
4
|
import { toAccount } from 'viem/accounts';
|
|
5
|
-
import { getCapabilities } from 'viem/experimental';
|
|
6
5
|
import { parseEvmNetworks, retryableFn, FALLBACK_UNDEFINED, DynamicError, UserRejectedRequestError, isMobile } from '@dynamic-labs/utils';
|
|
7
6
|
import { WalletConnectorBase, logger } from '@dynamic-labs/wallet-connector-core';
|
|
8
7
|
import '../utils/logger.js';
|
|
@@ -312,7 +311,7 @@ class EthereumWalletConnector extends WalletConnectorBase {
|
|
|
312
311
|
if (!walletClient) {
|
|
313
312
|
return false;
|
|
314
313
|
}
|
|
315
|
-
const capabilities = yield getCapabilities(
|
|
314
|
+
const capabilities = yield walletClient.getCapabilities();
|
|
316
315
|
const chainIdToCheck = chainId !== null && chainId !== void 0 ? chainId : (yield walletClient.getChainId());
|
|
317
316
|
logger.debug('[EthereumWalletConnector] isAtomicSupported', {
|
|
318
317
|
capabilities,
|
|
@@ -327,7 +326,7 @@ class EthereumWalletConnector extends WalletConnectorBase {
|
|
|
327
326
|
if (!walletClient) {
|
|
328
327
|
return false;
|
|
329
328
|
}
|
|
330
|
-
const capabilities = yield getCapabilities(
|
|
329
|
+
const capabilities = yield walletClient.getCapabilities();
|
|
331
330
|
const chainIdToCheck = chainId !== null && chainId !== void 0 ? chainId : (yield walletClient.getChainId());
|
|
332
331
|
logger.debug('[EthereumWalletConnector] isPaymasterServiceSupported', {
|
|
333
332
|
capabilities,
|
|
@@ -336,6 +335,14 @@ class EthereumWalletConnector extends WalletConnectorBase {
|
|
|
336
335
|
return hasPaymasterServiceCapability(capabilities, chainIdToCheck);
|
|
337
336
|
});
|
|
338
337
|
}
|
|
338
|
+
/**
|
|
339
|
+
* Whether the wallet supports sign authorization for eip-7702.
|
|
340
|
+
*
|
|
341
|
+
* @returns {boolean} Whether the wallet supports sign authorization
|
|
342
|
+
*/
|
|
343
|
+
isSignAuthorizationSupported() {
|
|
344
|
+
return false;
|
|
345
|
+
}
|
|
339
346
|
}
|
|
340
347
|
|
|
341
348
|
export { EthereumWalletConnector };
|
|
@@ -8,7 +8,7 @@ var viem = require('viem');
|
|
|
8
8
|
var utils = require('@dynamic-labs/utils');
|
|
9
9
|
var isTransactionExecutionError = require('../isTransactionExecutionError/isTransactionExecutionError.cjs');
|
|
10
10
|
|
|
11
|
-
const interceptTransport = ({ getAccounts, onPersonalSign, onSendTransaction, onSignTypedData, transport, }) => (props) => {
|
|
11
|
+
const interceptTransport = ({ getAccounts, onPersonalSign, onSendTransaction, onSignTypedData, onGetCapabilities, onSendCalls, transport, }) => (props) => {
|
|
12
12
|
const provider = transport(props);
|
|
13
13
|
return viem.custom({
|
|
14
14
|
request: (args) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
@@ -51,6 +51,13 @@ const interceptTransport = ({ getAccounts, onPersonalSign, onSendTransaction, on
|
|
|
51
51
|
throw error;
|
|
52
52
|
});
|
|
53
53
|
}
|
|
54
|
+
if (onGetCapabilities && method === 'wallet_getCapabilities') {
|
|
55
|
+
return onGetCapabilities({ provider });
|
|
56
|
+
}
|
|
57
|
+
if (onSendCalls && method === 'wallet_sendCalls') {
|
|
58
|
+
const [callParams] = params;
|
|
59
|
+
return onSendCalls({ callParams, provider });
|
|
60
|
+
}
|
|
54
61
|
return provider.request(args);
|
|
55
62
|
}),
|
|
56
63
|
})(props);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Address, CustomTransport, Hex, RpcTransactionRequest, Transport } from 'viem';
|
|
1
|
+
import { Address, CustomTransport, Hex, RpcTransactionRequest, Transport, GetCapabilitiesReturnType, SendCallsParameters, SendCallsReturnType } from 'viem';
|
|
2
2
|
type Provider = Pick<ReturnType<CustomTransport>, 'request'>;
|
|
3
3
|
export type InterceptTransportProps = {
|
|
4
4
|
transport: Transport;
|
|
@@ -20,10 +20,17 @@ export type InterceptTransportProps = {
|
|
|
20
20
|
args: Args;
|
|
21
21
|
provider: Provider;
|
|
22
22
|
}) => Promise<string>;
|
|
23
|
+
onGetCapabilities?: (props: {
|
|
24
|
+
provider: Provider;
|
|
25
|
+
}) => Promise<GetCapabilitiesReturnType>;
|
|
26
|
+
onSendCalls?: (props: {
|
|
27
|
+
callParams: SendCallsParameters;
|
|
28
|
+
provider: Provider;
|
|
29
|
+
}) => Promise<SendCallsReturnType>;
|
|
23
30
|
};
|
|
24
31
|
type Args = {
|
|
25
32
|
method: string;
|
|
26
33
|
params: unknown[];
|
|
27
34
|
};
|
|
28
|
-
export declare const interceptTransport: ({ getAccounts, onPersonalSign, onSendTransaction, onSignTypedData, transport, }: InterceptTransportProps) => CustomTransport;
|
|
35
|
+
export declare const interceptTransport: ({ getAccounts, onPersonalSign, onSendTransaction, onSignTypedData, onGetCapabilities, onSendCalls, transport, }: InterceptTransportProps) => CustomTransport;
|
|
29
36
|
export {};
|
|
@@ -4,7 +4,7 @@ import { custom, UserRejectedRequestError as UserRejectedRequestError$1 } from '
|
|
|
4
4
|
import { UserRejectedRequestError, UserRejectedTransactionError } from '@dynamic-labs/utils';
|
|
5
5
|
import { isTransactionExecutionError } from '../isTransactionExecutionError/isTransactionExecutionError.js';
|
|
6
6
|
|
|
7
|
-
const interceptTransport = ({ getAccounts, onPersonalSign, onSendTransaction, onSignTypedData, transport, }) => (props) => {
|
|
7
|
+
const interceptTransport = ({ getAccounts, onPersonalSign, onSendTransaction, onSignTypedData, onGetCapabilities, onSendCalls, transport, }) => (props) => {
|
|
8
8
|
const provider = transport(props);
|
|
9
9
|
return custom({
|
|
10
10
|
request: (args) => __awaiter(void 0, void 0, void 0, function* () {
|
|
@@ -47,6 +47,13 @@ const interceptTransport = ({ getAccounts, onPersonalSign, onSendTransaction, on
|
|
|
47
47
|
throw error;
|
|
48
48
|
});
|
|
49
49
|
}
|
|
50
|
+
if (onGetCapabilities && method === 'wallet_getCapabilities') {
|
|
51
|
+
return onGetCapabilities({ provider });
|
|
52
|
+
}
|
|
53
|
+
if (onSendCalls && method === 'wallet_sendCalls') {
|
|
54
|
+
const [callParams] = params;
|
|
55
|
+
return onSendCalls({ callParams, provider });
|
|
56
|
+
}
|
|
50
57
|
return provider.request(args);
|
|
51
58
|
}),
|
|
52
59
|
})(props);
|
|
@@ -5,7 +5,6 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
5
5
|
|
|
6
6
|
var _tslib = require('../../_virtual/_tslib.cjs');
|
|
7
7
|
var viem = require('viem');
|
|
8
|
-
var experimental = require('viem/experimental');
|
|
9
8
|
var walletConnectorCore = require('@dynamic-labs/wallet-connector-core');
|
|
10
9
|
require('@dynamic-labs/utils');
|
|
11
10
|
var logger = require('../utils/logger.cjs');
|
|
@@ -110,6 +109,9 @@ class EthereumWallet extends walletConnectorCore.Wallet {
|
|
|
110
109
|
getTransportConfig() {
|
|
111
110
|
return this._connector.providersConfig.httpTransportConfig;
|
|
112
111
|
}
|
|
112
|
+
isSignAuthorizationSupported() {
|
|
113
|
+
return this._connector.isSignAuthorizationSupported();
|
|
114
|
+
}
|
|
113
115
|
isPaymasterServiceSupported(chainId) {
|
|
114
116
|
return _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
115
117
|
try {
|
|
@@ -142,7 +144,7 @@ class EthereumWallet extends walletConnectorCore.Wallet {
|
|
|
142
144
|
}
|
|
143
145
|
sendCalls(callParams, options) {
|
|
144
146
|
return _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
145
|
-
var _a;
|
|
147
|
+
var _a, _b, _c;
|
|
146
148
|
const chainId = (_a = callParams.chain) === null || _a === void 0 ? void 0 : _a.id;
|
|
147
149
|
const walletClient = yield this.getWalletClient(chainId === null || chainId === void 0 ? void 0 : chainId.toString());
|
|
148
150
|
const atomicStatusSupported = yield this.isAtomicSupported(chainId);
|
|
@@ -153,14 +155,16 @@ class EthereumWallet extends walletConnectorCore.Wallet {
|
|
|
153
155
|
address: this.address,
|
|
154
156
|
key: this.key,
|
|
155
157
|
},
|
|
158
|
+
wcChainId: (_b = walletClient.chain) === null || _b === void 0 ? void 0 : _b.id,
|
|
156
159
|
});
|
|
157
160
|
throw new Error('Atomic is not supported for this wallet and chain');
|
|
158
161
|
}
|
|
159
162
|
const paymasterServiceSupported = yield this.isPaymasterServiceSupported(chainId);
|
|
163
|
+
const chainIdToUse = chainId !== null && chainId !== void 0 ? chainId : (_c = walletClient.chain) === null || _c === void 0 ? void 0 : _c.id;
|
|
160
164
|
if (paymasterServiceSupported && (options === null || options === void 0 ? void 0 : options.paymasterURL)) {
|
|
161
165
|
callParams.capabilities = {
|
|
162
166
|
paymasterService: {
|
|
163
|
-
[
|
|
167
|
+
[chainIdToUse]: {
|
|
164
168
|
url: options === null || options === void 0 ? void 0 : options.paymasterURL,
|
|
165
169
|
},
|
|
166
170
|
},
|
|
@@ -170,10 +174,10 @@ class EthereumWallet extends walletConnectorCore.Wallet {
|
|
|
170
174
|
atomicStatusSupported,
|
|
171
175
|
callOptions: options,
|
|
172
176
|
callParams,
|
|
173
|
-
|
|
177
|
+
chainIdToUse,
|
|
174
178
|
paymasterServiceSupported,
|
|
175
179
|
});
|
|
176
|
-
const result = yield
|
|
180
|
+
const result = yield walletClient.sendCalls(callParams);
|
|
177
181
|
logger.logger.logVerboseTroubleshootingMessage('[EthereumWallet] sendCalls', {
|
|
178
182
|
result,
|
|
179
183
|
});
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { Account, Chain, HttpTransportConfig, PublicClient, Transport, WalletClient } from 'viem';
|
|
2
|
-
import { SendCallsParameters, SendCallsReturnType } from 'viem/experimental';
|
|
1
|
+
import { Account, Chain, HttpTransportConfig, PublicClient, Transport, WalletClient, SendCallsParameters, SendCallsReturnType } from 'viem';
|
|
3
2
|
import { Wallet, WalletProps } from '@dynamic-labs/wallet-connector-core';
|
|
4
3
|
import { EthereumWalletConnector } from '../connector';
|
|
5
4
|
export declare class EthereumWallet extends Wallet<EthereumWalletConnector> {
|
|
@@ -35,6 +34,7 @@ export declare class EthereumWallet extends Wallet<EthereumWalletConnector> {
|
|
|
35
34
|
*/
|
|
36
35
|
getWalletClient(chainId?: string): Promise<WalletClient<Transport, Chain, Account>>;
|
|
37
36
|
getTransportConfig(): HttpTransportConfig | undefined;
|
|
37
|
+
isSignAuthorizationSupported(): boolean;
|
|
38
38
|
isPaymasterServiceSupported(chainId?: number): Promise<boolean>;
|
|
39
39
|
isAtomicSupported(chainId?: number): Promise<boolean>;
|
|
40
40
|
sendCalls(callParams: Omit<SendCallsParameters, 'account'>, options?: {
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
'use client'
|
|
2
2
|
import { __awaiter } from '../../_virtual/_tslib.js';
|
|
3
3
|
import { getContract, parseUnits, parseEther, createWalletClient, custom } from 'viem';
|
|
4
|
-
import { sendCalls } from 'viem/experimental';
|
|
5
4
|
import { Wallet } from '@dynamic-labs/wallet-connector-core';
|
|
6
5
|
import '@dynamic-labs/utils';
|
|
7
6
|
import { logger } from '../utils/logger.js';
|
|
@@ -106,6 +105,9 @@ class EthereumWallet extends Wallet {
|
|
|
106
105
|
getTransportConfig() {
|
|
107
106
|
return this._connector.providersConfig.httpTransportConfig;
|
|
108
107
|
}
|
|
108
|
+
isSignAuthorizationSupported() {
|
|
109
|
+
return this._connector.isSignAuthorizationSupported();
|
|
110
|
+
}
|
|
109
111
|
isPaymasterServiceSupported(chainId) {
|
|
110
112
|
return __awaiter(this, void 0, void 0, function* () {
|
|
111
113
|
try {
|
|
@@ -138,7 +140,7 @@ class EthereumWallet extends Wallet {
|
|
|
138
140
|
}
|
|
139
141
|
sendCalls(callParams, options) {
|
|
140
142
|
return __awaiter(this, void 0, void 0, function* () {
|
|
141
|
-
var _a;
|
|
143
|
+
var _a, _b, _c;
|
|
142
144
|
const chainId = (_a = callParams.chain) === null || _a === void 0 ? void 0 : _a.id;
|
|
143
145
|
const walletClient = yield this.getWalletClient(chainId === null || chainId === void 0 ? void 0 : chainId.toString());
|
|
144
146
|
const atomicStatusSupported = yield this.isAtomicSupported(chainId);
|
|
@@ -149,14 +151,16 @@ class EthereumWallet extends Wallet {
|
|
|
149
151
|
address: this.address,
|
|
150
152
|
key: this.key,
|
|
151
153
|
},
|
|
154
|
+
wcChainId: (_b = walletClient.chain) === null || _b === void 0 ? void 0 : _b.id,
|
|
152
155
|
});
|
|
153
156
|
throw new Error('Atomic is not supported for this wallet and chain');
|
|
154
157
|
}
|
|
155
158
|
const paymasterServiceSupported = yield this.isPaymasterServiceSupported(chainId);
|
|
159
|
+
const chainIdToUse = chainId !== null && chainId !== void 0 ? chainId : (_c = walletClient.chain) === null || _c === void 0 ? void 0 : _c.id;
|
|
156
160
|
if (paymasterServiceSupported && (options === null || options === void 0 ? void 0 : options.paymasterURL)) {
|
|
157
161
|
callParams.capabilities = {
|
|
158
162
|
paymasterService: {
|
|
159
|
-
[
|
|
163
|
+
[chainIdToUse]: {
|
|
160
164
|
url: options === null || options === void 0 ? void 0 : options.paymasterURL,
|
|
161
165
|
},
|
|
162
166
|
},
|
|
@@ -166,10 +170,10 @@ class EthereumWallet extends Wallet {
|
|
|
166
170
|
atomicStatusSupported,
|
|
167
171
|
callOptions: options,
|
|
168
172
|
callParams,
|
|
169
|
-
|
|
173
|
+
chainIdToUse,
|
|
170
174
|
paymasterServiceSupported,
|
|
171
175
|
});
|
|
172
|
-
const result = yield sendCalls(
|
|
176
|
+
const result = yield walletClient.sendCalls(callParams);
|
|
173
177
|
logger.logVerboseTroubleshootingMessage('[EthereumWallet] sendCalls', {
|
|
174
178
|
result,
|
|
175
179
|
});
|