@dynamic-labs/ethereum-core 4.16.0 → 4.17.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 +15 -0
- package/package.cjs +1 -1
- package/package.js +1 -1
- package/package.json +8 -8
- package/src/connector/EthereumWalletConnector.cjs +3 -3
- package/src/connector/EthereumWalletConnector.js +3 -3
- package/src/index.cjs +0 -2
- package/src/index.js +0 -1
- package/src/utils/viem/hasAtomicStatusCapability/hasAtomicStatusCapability.cjs +12 -1
- package/src/utils/viem/hasAtomicStatusCapability/hasAtomicStatusCapability.js +12 -1
- package/src/utils/viem/index.d.ts +0 -1
- package/src/wallet/EthereumWallet.cjs +44 -6
- package/src/wallet/EthereumWallet.d.ts +6 -2
- package/src/wallet/EthereumWallet.js +44 -6
- package/src/utils/viem/getWalletCapabilities/getWalletCapabilities.cjs +0 -11
- package/src/utils/viem/getWalletCapabilities/getWalletCapabilities.d.ts +0 -4
- package/src/utils/viem/getWalletCapabilities/getWalletCapabilities.js +0 -7
- package/src/utils/viem/getWalletCapabilities/index.d.ts +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,4 +1,19 @@
|
|
|
1
1
|
|
|
2
|
+
## [4.17.0](https://github.com/dynamic-labs/dynamic-auth/compare/v4.16.0...v4.17.0) (2025-05-06)
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
### Features
|
|
6
|
+
|
|
7
|
+
* add chain id option to create kernel client in react-native ([#8650](https://github.com/dynamic-labs/dynamic-auth/issues/8650)) ([1450bea](https://github.com/dynamic-labs/dynamic-auth/commit/1450bea6f979a82ed4880700aff14fa1ead9dc60))
|
|
8
|
+
* add sendCalls method to EthereumWallet ([#8634](https://github.com/dynamic-labs/dynamic-auth/issues/8634)) ([7c9aef9](https://github.com/dynamic-labs/dynamic-auth/commit/7c9aef95382b4823a40279bebfb084de32c25610))
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Bug Fixes
|
|
12
|
+
|
|
13
|
+
* 7702 do not override existing old aa ([#8630](https://github.com/dynamic-labs/dynamic-auth/issues/8630)) ([a731d9e](https://github.com/dynamic-labs/dynamic-auth/commit/a731d9e77ecd9e1dec3a7704a63989b5f2741a57))
|
|
14
|
+
* improve error message when email login fails ([#8649](https://github.com/dynamic-labs/dynamic-auth/issues/8649)) ([e1c03ac](https://github.com/dynamic-labs/dynamic-auth/commit/e1c03ac6dc83386c63d63db59d31355bc4fe2959))
|
|
15
|
+
* improve react-native stability on android ([#8652](https://github.com/dynamic-labs/dynamic-auth/issues/8652)) ([1617546](https://github.com/dynamic-labs/dynamic-auth/commit/1617546e6053c2ab32f7d385336c47df185d077f))
|
|
16
|
+
|
|
2
17
|
## [4.16.0](https://github.com/dynamic-labs/dynamic-auth/compare/v4.15.0...v4.16.0) (2025-05-03)
|
|
3
18
|
|
|
4
19
|
|
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.
|
|
3
|
+
"version": "4.17.0",
|
|
4
4
|
"description": "Core package for utilities and types for viem",
|
|
5
5
|
"author": "Dynamic Labs, Inc.",
|
|
6
6
|
"license": "MIT",
|
|
@@ -19,13 +19,13 @@
|
|
|
19
19
|
"homepage": "https://www.dynamic.xyz/",
|
|
20
20
|
"dependencies": {
|
|
21
21
|
"@dynamic-labs/sdk-api-core": "0.0.660",
|
|
22
|
-
"@dynamic-labs/assert-package-version": "4.
|
|
23
|
-
"@dynamic-labs/logger": "4.
|
|
24
|
-
"@dynamic-labs/rpc-providers": "4.
|
|
25
|
-
"@dynamic-labs/types": "4.
|
|
26
|
-
"@dynamic-labs/utils": "4.
|
|
27
|
-
"@dynamic-labs/wallet-book": "4.
|
|
28
|
-
"@dynamic-labs/wallet-connector-core": "4.
|
|
22
|
+
"@dynamic-labs/assert-package-version": "4.17.0",
|
|
23
|
+
"@dynamic-labs/logger": "4.17.0",
|
|
24
|
+
"@dynamic-labs/rpc-providers": "4.17.0",
|
|
25
|
+
"@dynamic-labs/types": "4.17.0",
|
|
26
|
+
"@dynamic-labs/utils": "4.17.0",
|
|
27
|
+
"@dynamic-labs/wallet-book": "4.17.0",
|
|
28
|
+
"@dynamic-labs/wallet-connector-core": "4.17.0"
|
|
29
29
|
},
|
|
30
30
|
"peerDependencies": {
|
|
31
31
|
"viem": "^2.21.60"
|
|
@@ -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 accounts = require('viem/accounts');
|
|
9
|
+
var experimental = require('viem/experimental');
|
|
9
10
|
var utils = require('@dynamic-labs/utils');
|
|
10
11
|
var walletConnectorCore = require('@dynamic-labs/wallet-connector-core');
|
|
11
12
|
require('../utils/logger.cjs');
|
|
@@ -13,7 +14,6 @@ require('../utils/viem/estimateL1Fee/opStack/estimateL1Fee.cjs');
|
|
|
13
14
|
var chainsMap = require('../utils/viem/chainsMap/chainsMap.cjs');
|
|
14
15
|
var createViemUiTransaction = require('../utils/viem/createViemUiTransaction/createViemUiTransaction.cjs');
|
|
15
16
|
var getOrMapViemChain = require('../utils/viem/getOrMapViemChain/getOrMapViemChain.cjs');
|
|
16
|
-
var getWalletCapabilities = require('../utils/viem/getWalletCapabilities/getWalletCapabilities.cjs');
|
|
17
17
|
var hasAtomicStatusCapability = require('../utils/viem/hasAtomicStatusCapability/hasAtomicStatusCapability.cjs');
|
|
18
18
|
var hasPaymasterServiceCapability = require('../utils/viem/hasPaymasterServiceCapability/hasPaymasterServiceCapability.cjs');
|
|
19
19
|
var findEvmNetwork = require('../utils/findEvmNetwork/findEvmNetwork.cjs');
|
|
@@ -316,7 +316,7 @@ class EthereumWalletConnector extends walletConnectorCore.WalletConnectorBase {
|
|
|
316
316
|
if (!walletClient) {
|
|
317
317
|
return false;
|
|
318
318
|
}
|
|
319
|
-
const capabilities = yield
|
|
319
|
+
const capabilities = yield experimental.getCapabilities(walletClient);
|
|
320
320
|
const chainIdToCheck = chainId !== null && chainId !== void 0 ? chainId : (yield walletClient.getChainId());
|
|
321
321
|
walletConnectorCore.logger.debug('[EthereumWalletConnector] isAtomicSupported', {
|
|
322
322
|
capabilities,
|
|
@@ -331,7 +331,7 @@ class EthereumWalletConnector extends walletConnectorCore.WalletConnectorBase {
|
|
|
331
331
|
if (!walletClient) {
|
|
332
332
|
return false;
|
|
333
333
|
}
|
|
334
|
-
const capabilities = yield
|
|
334
|
+
const capabilities = yield experimental.getCapabilities(walletClient);
|
|
335
335
|
const chainIdToCheck = chainId !== null && chainId !== void 0 ? chainId : (yield walletClient.getChainId());
|
|
336
336
|
walletConnectorCore.logger.debug('[EthereumWalletConnector] isPaymasterServiceSupported', {
|
|
337
337
|
capabilities,
|
|
@@ -2,6 +2,7 @@
|
|
|
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';
|
|
5
6
|
import { parseEvmNetworks, retryableFn, FALLBACK_UNDEFINED, DynamicError, UserRejectedRequestError, isMobile } from '@dynamic-labs/utils';
|
|
6
7
|
import { WalletConnectorBase, logger } from '@dynamic-labs/wallet-connector-core';
|
|
7
8
|
import '../utils/logger.js';
|
|
@@ -9,7 +10,6 @@ import '../utils/viem/estimateL1Fee/opStack/estimateL1Fee.js';
|
|
|
9
10
|
import { chainsMap } from '../utils/viem/chainsMap/chainsMap.js';
|
|
10
11
|
import { createViemUiTransaction } from '../utils/viem/createViemUiTransaction/createViemUiTransaction.js';
|
|
11
12
|
import { getOrMapViemChain } from '../utils/viem/getOrMapViemChain/getOrMapViemChain.js';
|
|
12
|
-
import { getWalletCapabilities } from '../utils/viem/getWalletCapabilities/getWalletCapabilities.js';
|
|
13
13
|
import { hasAtomicStatusCapability } from '../utils/viem/hasAtomicStatusCapability/hasAtomicStatusCapability.js';
|
|
14
14
|
import { hasPaymasterServiceCapability } from '../utils/viem/hasPaymasterServiceCapability/hasPaymasterServiceCapability.js';
|
|
15
15
|
import { findEvmNetwork } from '../utils/findEvmNetwork/findEvmNetwork.js';
|
|
@@ -312,7 +312,7 @@ class EthereumWalletConnector extends WalletConnectorBase {
|
|
|
312
312
|
if (!walletClient) {
|
|
313
313
|
return false;
|
|
314
314
|
}
|
|
315
|
-
const capabilities = yield
|
|
315
|
+
const capabilities = yield getCapabilities(walletClient);
|
|
316
316
|
const chainIdToCheck = chainId !== null && chainId !== void 0 ? chainId : (yield walletClient.getChainId());
|
|
317
317
|
logger.debug('[EthereumWalletConnector] isAtomicSupported', {
|
|
318
318
|
capabilities,
|
|
@@ -327,7 +327,7 @@ class EthereumWalletConnector extends WalletConnectorBase {
|
|
|
327
327
|
if (!walletClient) {
|
|
328
328
|
return false;
|
|
329
329
|
}
|
|
330
|
-
const capabilities = yield
|
|
330
|
+
const capabilities = yield getCapabilities(walletClient);
|
|
331
331
|
const chainIdToCheck = chainId !== null && chainId !== void 0 ? chainId : (yield walletClient.getChainId());
|
|
332
332
|
logger.debug('[EthereumWalletConnector] isPaymasterServiceSupported', {
|
|
333
333
|
capabilities,
|
package/src/index.cjs
CHANGED
|
@@ -19,7 +19,6 @@ var createTransportWithUiConfirmation = require('./utils/viem/createTransportWit
|
|
|
19
19
|
var createViemUiTransaction = require('./utils/viem/createViemUiTransaction/createViemUiTransaction.cjs');
|
|
20
20
|
var createWalletClientWithUiConfirmation = require('./utils/viem/createWalletClientWithUiConfirmation/createWalletClientWithUiConfirmation.cjs');
|
|
21
21
|
var getOrMapViemChain = require('./utils/viem/getOrMapViemChain/getOrMapViemChain.cjs');
|
|
22
|
-
var getWalletCapabilities = require('./utils/viem/getWalletCapabilities/getWalletCapabilities.cjs');
|
|
23
22
|
var hasAtomicStatusCapability = require('./utils/viem/hasAtomicStatusCapability/hasAtomicStatusCapability.cjs');
|
|
24
23
|
var hasPaymasterServiceCapability = require('./utils/viem/hasPaymasterServiceCapability/hasPaymasterServiceCapability.cjs');
|
|
25
24
|
var unFormatTransaction = require('./utils/viem/unFormatTransaction/unFormatTransaction.cjs');
|
|
@@ -48,7 +47,6 @@ exports.createWalletClientWithUiConfirmation = createWalletClientWithUiConfirmat
|
|
|
48
47
|
exports.getChain = getOrMapViemChain.getChain;
|
|
49
48
|
exports.getOrMapViemChain = getOrMapViemChain.getOrMapViemChain;
|
|
50
49
|
exports.mapChain = getOrMapViemChain.mapChain;
|
|
51
|
-
exports.getWalletCapabilities = getWalletCapabilities.getWalletCapabilities;
|
|
52
50
|
exports.hasAtomicStatusCapability = hasAtomicStatusCapability.hasAtomicStatusCapability;
|
|
53
51
|
exports.hasPaymasterServiceCapability = hasPaymasterServiceCapability.hasPaymasterServiceCapability;
|
|
54
52
|
exports.unFormatTransaction = unFormatTransaction.unFormatTransaction;
|
package/src/index.js
CHANGED
|
@@ -15,7 +15,6 @@ export { createTransportWithUiConfirmation } from './utils/viem/createTransportW
|
|
|
15
15
|
export { createViemUiTransaction } from './utils/viem/createViemUiTransaction/createViemUiTransaction.js';
|
|
16
16
|
export { createWalletClientWithUiConfirmation } from './utils/viem/createWalletClientWithUiConfirmation/createWalletClientWithUiConfirmation.js';
|
|
17
17
|
export { getChain, getOrMapViemChain, mapChain } from './utils/viem/getOrMapViemChain/getOrMapViemChain.js';
|
|
18
|
-
export { getWalletCapabilities } from './utils/viem/getWalletCapabilities/getWalletCapabilities.js';
|
|
19
18
|
export { hasAtomicStatusCapability } from './utils/viem/hasAtomicStatusCapability/hasAtomicStatusCapability.js';
|
|
20
19
|
export { hasPaymasterServiceCapability } from './utils/viem/hasPaymasterServiceCapability/hasPaymasterServiceCapability.js';
|
|
21
20
|
export { unFormatTransaction } from './utils/viem/unFormatTransaction/unFormatTransaction.js';
|
|
@@ -3,14 +3,25 @@
|
|
|
3
3
|
|
|
4
4
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
5
5
|
|
|
6
|
+
var logger = require('../../logger.cjs');
|
|
7
|
+
|
|
6
8
|
const hasAtomicStatusCapability = (capabilities, chainId) => {
|
|
7
9
|
if (!(capabilities === null || capabilities === void 0 ? void 0 : capabilities[chainId])) {
|
|
8
10
|
return false;
|
|
9
11
|
}
|
|
10
12
|
const chainCapabilities = capabilities[chainId];
|
|
11
|
-
|
|
13
|
+
const hasAtomicStatus = Boolean(chainCapabilities['atomic'] &&
|
|
12
14
|
(chainCapabilities['atomic'].status === 'ready' ||
|
|
13
15
|
chainCapabilities['atomic'].status === 'supported'));
|
|
16
|
+
// coinbase uses 'atomicBatch.support' instead of 'atomic.status'
|
|
17
|
+
const hasAtomicBatchSupport = Boolean(chainCapabilities['atomicBatch'] &&
|
|
18
|
+
chainCapabilities['atomicBatch'].supported === true);
|
|
19
|
+
logger.logger.debug('[hasAtomicStatusCapability]', {
|
|
20
|
+
chainCapabilities,
|
|
21
|
+
hasAtomicBatchSupport,
|
|
22
|
+
hasAtomicStatus,
|
|
23
|
+
});
|
|
24
|
+
return hasAtomicStatus || hasAtomicBatchSupport;
|
|
14
25
|
};
|
|
15
26
|
|
|
16
27
|
exports.hasAtomicStatusCapability = hasAtomicStatusCapability;
|
|
@@ -1,12 +1,23 @@
|
|
|
1
1
|
'use client'
|
|
2
|
+
import { logger } from '../../logger.js';
|
|
3
|
+
|
|
2
4
|
const hasAtomicStatusCapability = (capabilities, chainId) => {
|
|
3
5
|
if (!(capabilities === null || capabilities === void 0 ? void 0 : capabilities[chainId])) {
|
|
4
6
|
return false;
|
|
5
7
|
}
|
|
6
8
|
const chainCapabilities = capabilities[chainId];
|
|
7
|
-
|
|
9
|
+
const hasAtomicStatus = Boolean(chainCapabilities['atomic'] &&
|
|
8
10
|
(chainCapabilities['atomic'].status === 'ready' ||
|
|
9
11
|
chainCapabilities['atomic'].status === 'supported'));
|
|
12
|
+
// coinbase uses 'atomicBatch.support' instead of 'atomic.status'
|
|
13
|
+
const hasAtomicBatchSupport = Boolean(chainCapabilities['atomicBatch'] &&
|
|
14
|
+
chainCapabilities['atomicBatch'].supported === true);
|
|
15
|
+
logger.debug('[hasAtomicStatusCapability]', {
|
|
16
|
+
chainCapabilities,
|
|
17
|
+
hasAtomicBatchSupport,
|
|
18
|
+
hasAtomicStatus,
|
|
19
|
+
});
|
|
20
|
+
return hasAtomicStatus || hasAtomicBatchSupport;
|
|
10
21
|
};
|
|
11
22
|
|
|
12
23
|
export { hasAtomicStatusCapability };
|
|
@@ -6,7 +6,6 @@ export * from './createTransportWithUiConfirmation';
|
|
|
6
6
|
export * from './createViemUiTransaction';
|
|
7
7
|
export * from './createWalletClientWithUiConfirmation';
|
|
8
8
|
export * from './getOrMapViemChain';
|
|
9
|
-
export * from './getWalletCapabilities';
|
|
10
9
|
export * from './hasAtomicStatusCapability';
|
|
11
10
|
export * from './hasPaymasterServiceCapability';
|
|
12
11
|
export * from './unFormatTransaction';
|
|
@@ -5,16 +5,16 @@ 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');
|
|
8
9
|
var walletConnectorCore = require('@dynamic-labs/wallet-connector-core');
|
|
9
10
|
require('@dynamic-labs/utils');
|
|
10
|
-
require('../utils/logger.cjs');
|
|
11
|
+
var logger = require('../utils/logger.cjs');
|
|
11
12
|
require('../utils/viem/estimateL1Fee/opStack/estimateL1Fee.cjs');
|
|
12
13
|
require('../utils/viem/chainsMap/chainsMap.cjs');
|
|
13
14
|
var interceptTransport = require('../utils/viem/interceptTransport/interceptTransport.cjs');
|
|
14
15
|
var abi = require('../utils/viem/erc20/abi.cjs');
|
|
15
16
|
require('viem/accounts');
|
|
16
17
|
var getOrMapViemChain = require('../utils/viem/getOrMapViemChain/getOrMapViemChain.cjs');
|
|
17
|
-
require('viem/experimental');
|
|
18
18
|
var parseAddress = require('../utils/parseAddress/parseAddress.cjs');
|
|
19
19
|
|
|
20
20
|
class EthereumWallet extends walletConnectorCore.Wallet {
|
|
@@ -110,14 +110,52 @@ class EthereumWallet extends walletConnectorCore.Wallet {
|
|
|
110
110
|
getTransportConfig() {
|
|
111
111
|
return this._connector.providersConfig.httpTransportConfig;
|
|
112
112
|
}
|
|
113
|
-
isPaymasterServiceSupported() {
|
|
113
|
+
isPaymasterServiceSupported(chainId) {
|
|
114
114
|
return _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
115
|
-
return this._connector.isPaymasterServiceSupported();
|
|
115
|
+
return this._connector.isPaymasterServiceSupported(chainId);
|
|
116
116
|
});
|
|
117
117
|
}
|
|
118
|
-
isAtomicSupported() {
|
|
118
|
+
isAtomicSupported(chainId) {
|
|
119
119
|
return _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
120
|
-
return this._connector.isAtomicSupported();
|
|
120
|
+
return this._connector.isAtomicSupported(chainId);
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
sendCalls(callParams, options) {
|
|
124
|
+
return _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
125
|
+
var _a;
|
|
126
|
+
const chainId = (_a = callParams.chain) === null || _a === void 0 ? void 0 : _a.id;
|
|
127
|
+
const walletClient = yield this.getWalletClient(chainId === null || chainId === void 0 ? void 0 : chainId.toString());
|
|
128
|
+
const atomicStatusSupported = yield this.isAtomicSupported(chainId);
|
|
129
|
+
if (!atomicStatusSupported) {
|
|
130
|
+
logger.logger.debug('[EthereumWallet] atomic is not supported wallet or chain', {
|
|
131
|
+
chainId,
|
|
132
|
+
wallet: {
|
|
133
|
+
address: this.address,
|
|
134
|
+
key: this.key,
|
|
135
|
+
},
|
|
136
|
+
});
|
|
137
|
+
throw new Error('Atomic is not supported for this wallet and chain');
|
|
138
|
+
}
|
|
139
|
+
const paymasterServiceSupported = yield this.isPaymasterServiceSupported(chainId);
|
|
140
|
+
if (paymasterServiceSupported && (options === null || options === void 0 ? void 0 : options.paymasterURL)) {
|
|
141
|
+
callParams.capabilities = {
|
|
142
|
+
paymasterService: {
|
|
143
|
+
url: options === null || options === void 0 ? void 0 : options.paymasterURL,
|
|
144
|
+
},
|
|
145
|
+
};
|
|
146
|
+
}
|
|
147
|
+
logger.logger.logVerboseTroubleshootingMessage('[EthereumWallet] sendCalls', {
|
|
148
|
+
atomicStatusSupported,
|
|
149
|
+
callOptions: options,
|
|
150
|
+
callParams,
|
|
151
|
+
chainId,
|
|
152
|
+
paymasterServiceSupported,
|
|
153
|
+
});
|
|
154
|
+
const result = yield experimental.sendCalls(walletClient, callParams);
|
|
155
|
+
logger.logger.logVerboseTroubleshootingMessage('[EthereumWallet] sendCalls', {
|
|
156
|
+
result,
|
|
157
|
+
});
|
|
158
|
+
return result;
|
|
121
159
|
});
|
|
122
160
|
}
|
|
123
161
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Account, Chain, HttpTransportConfig, PublicClient, Transport, WalletClient } from 'viem';
|
|
2
|
+
import { SendCallsParameters, SendCallsReturnType } from 'viem/experimental';
|
|
2
3
|
import { Wallet, WalletProps } from '@dynamic-labs/wallet-connector-core';
|
|
3
4
|
import { EthereumWalletConnector } from '../connector';
|
|
4
5
|
export declare class EthereumWallet extends Wallet<EthereumWalletConnector> {
|
|
@@ -34,6 +35,9 @@ export declare class EthereumWallet extends Wallet<EthereumWalletConnector> {
|
|
|
34
35
|
*/
|
|
35
36
|
getWalletClient(chainId?: string): Promise<WalletClient<Transport, Chain, Account>>;
|
|
36
37
|
getTransportConfig(): HttpTransportConfig | undefined;
|
|
37
|
-
isPaymasterServiceSupported(): Promise<boolean>;
|
|
38
|
-
isAtomicSupported(): Promise<boolean>;
|
|
38
|
+
isPaymasterServiceSupported(chainId?: number): Promise<boolean>;
|
|
39
|
+
isAtomicSupported(chainId?: number): Promise<boolean>;
|
|
40
|
+
sendCalls(callParams: Omit<SendCallsParameters, 'account'>, options?: {
|
|
41
|
+
paymasterURL?: string;
|
|
42
|
+
}): Promise<SendCallsReturnType>;
|
|
39
43
|
}
|
|
@@ -1,16 +1,16 @@
|
|
|
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';
|
|
4
5
|
import { Wallet } from '@dynamic-labs/wallet-connector-core';
|
|
5
6
|
import '@dynamic-labs/utils';
|
|
6
|
-
import '../utils/logger.js';
|
|
7
|
+
import { logger } from '../utils/logger.js';
|
|
7
8
|
import '../utils/viem/estimateL1Fee/opStack/estimateL1Fee.js';
|
|
8
9
|
import '../utils/viem/chainsMap/chainsMap.js';
|
|
9
10
|
import { interceptTransport } from '../utils/viem/interceptTransport/interceptTransport.js';
|
|
10
11
|
import { erc20Abi } from '../utils/viem/erc20/abi.js';
|
|
11
12
|
import 'viem/accounts';
|
|
12
13
|
import { getChain } from '../utils/viem/getOrMapViemChain/getOrMapViemChain.js';
|
|
13
|
-
import 'viem/experimental';
|
|
14
14
|
import { parseAddress } from '../utils/parseAddress/parseAddress.js';
|
|
15
15
|
|
|
16
16
|
class EthereumWallet extends Wallet {
|
|
@@ -106,14 +106,52 @@ class EthereumWallet extends Wallet {
|
|
|
106
106
|
getTransportConfig() {
|
|
107
107
|
return this._connector.providersConfig.httpTransportConfig;
|
|
108
108
|
}
|
|
109
|
-
isPaymasterServiceSupported() {
|
|
109
|
+
isPaymasterServiceSupported(chainId) {
|
|
110
110
|
return __awaiter(this, void 0, void 0, function* () {
|
|
111
|
-
return this._connector.isPaymasterServiceSupported();
|
|
111
|
+
return this._connector.isPaymasterServiceSupported(chainId);
|
|
112
112
|
});
|
|
113
113
|
}
|
|
114
|
-
isAtomicSupported() {
|
|
114
|
+
isAtomicSupported(chainId) {
|
|
115
115
|
return __awaiter(this, void 0, void 0, function* () {
|
|
116
|
-
return this._connector.isAtomicSupported();
|
|
116
|
+
return this._connector.isAtomicSupported(chainId);
|
|
117
|
+
});
|
|
118
|
+
}
|
|
119
|
+
sendCalls(callParams, options) {
|
|
120
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
121
|
+
var _a;
|
|
122
|
+
const chainId = (_a = callParams.chain) === null || _a === void 0 ? void 0 : _a.id;
|
|
123
|
+
const walletClient = yield this.getWalletClient(chainId === null || chainId === void 0 ? void 0 : chainId.toString());
|
|
124
|
+
const atomicStatusSupported = yield this.isAtomicSupported(chainId);
|
|
125
|
+
if (!atomicStatusSupported) {
|
|
126
|
+
logger.debug('[EthereumWallet] atomic is not supported wallet or chain', {
|
|
127
|
+
chainId,
|
|
128
|
+
wallet: {
|
|
129
|
+
address: this.address,
|
|
130
|
+
key: this.key,
|
|
131
|
+
},
|
|
132
|
+
});
|
|
133
|
+
throw new Error('Atomic is not supported for this wallet and chain');
|
|
134
|
+
}
|
|
135
|
+
const paymasterServiceSupported = yield this.isPaymasterServiceSupported(chainId);
|
|
136
|
+
if (paymasterServiceSupported && (options === null || options === void 0 ? void 0 : options.paymasterURL)) {
|
|
137
|
+
callParams.capabilities = {
|
|
138
|
+
paymasterService: {
|
|
139
|
+
url: options === null || options === void 0 ? void 0 : options.paymasterURL,
|
|
140
|
+
},
|
|
141
|
+
};
|
|
142
|
+
}
|
|
143
|
+
logger.logVerboseTroubleshootingMessage('[EthereumWallet] sendCalls', {
|
|
144
|
+
atomicStatusSupported,
|
|
145
|
+
callOptions: options,
|
|
146
|
+
callParams,
|
|
147
|
+
chainId,
|
|
148
|
+
paymasterServiceSupported,
|
|
149
|
+
});
|
|
150
|
+
const result = yield sendCalls(walletClient, callParams);
|
|
151
|
+
logger.logVerboseTroubleshootingMessage('[EthereumWallet] sendCalls', {
|
|
152
|
+
result,
|
|
153
|
+
});
|
|
154
|
+
return result;
|
|
117
155
|
});
|
|
118
156
|
}
|
|
119
157
|
}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
'use client'
|
|
2
|
-
'use strict';
|
|
3
|
-
|
|
4
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
5
|
-
|
|
6
|
-
var _tslib = require('../../../../_virtual/_tslib.cjs');
|
|
7
|
-
var experimental = require('viem/experimental');
|
|
8
|
-
|
|
9
|
-
const getWalletCapabilities = (walletClient) => _tslib.__awaiter(void 0, void 0, void 0, function* () { return walletClient.extend(experimental.eip5792Actions()).getCapabilities(); });
|
|
10
|
-
|
|
11
|
-
exports.getWalletCapabilities = getWalletCapabilities;
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
'use client'
|
|
2
|
-
import { __awaiter } from '../../../../_virtual/_tslib.js';
|
|
3
|
-
import { eip5792Actions } from 'viem/experimental';
|
|
4
|
-
|
|
5
|
-
const getWalletCapabilities = (walletClient) => __awaiter(void 0, void 0, void 0, function* () { return walletClient.extend(eip5792Actions()).getCapabilities(); });
|
|
6
|
-
|
|
7
|
-
export { getWalletCapabilities };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { getWalletCapabilities } from './getWalletCapabilities';
|