@dynamic-labs/ethereum-aa 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 +10 -10
- package/src/ZeroDevConnector.cjs +94 -17
- package/src/ZeroDevConnector.d.ts +5 -0
- package/src/ZeroDevConnector.js +96 -19
- package/src/index.cjs +7 -1
- package/src/index.d.ts +3 -2
- package/src/index.js +4 -2
- package/src/utils/createEcdsaKernelAccountClient.cjs +9 -4
- package/src/utils/createEcdsaKernelAccountClient.d.ts +5 -1
- package/src/utils/createEcdsaKernelAccountClient.js +10 -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-aa",
|
|
3
|
-
"version": "4.18.
|
|
3
|
+
"version": "4.18.5",
|
|
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",
|
|
@@ -18,18 +18,18 @@
|
|
|
18
18
|
},
|
|
19
19
|
"homepage": "https://www.dynamic.xyz/",
|
|
20
20
|
"dependencies": {
|
|
21
|
-
"@dynamic-labs/sdk-api-core": "0.0.
|
|
21
|
+
"@dynamic-labs/sdk-api-core": "0.0.667",
|
|
22
22
|
"@zerodev/ecdsa-validator": "5.4.8",
|
|
23
23
|
"@zerodev/multi-chain-ecdsa-validator": "5.4.5",
|
|
24
24
|
"@zerodev/sdk": "5.4.34",
|
|
25
|
-
"@dynamic-labs/assert-package-version": "4.18.
|
|
26
|
-
"@dynamic-labs/ethereum-aa-core": "4.18.
|
|
27
|
-
"@dynamic-labs/ethereum-core": "4.18.
|
|
28
|
-
"@dynamic-labs/logger": "4.18.
|
|
29
|
-
"@dynamic-labs/types": "4.18.
|
|
30
|
-
"@dynamic-labs/utils": "4.18.
|
|
31
|
-
"@dynamic-labs/wallet-book": "4.18.
|
|
32
|
-
"@dynamic-labs/wallet-connector-core": "4.18.
|
|
25
|
+
"@dynamic-labs/assert-package-version": "4.18.5",
|
|
26
|
+
"@dynamic-labs/ethereum-aa-core": "4.18.5",
|
|
27
|
+
"@dynamic-labs/ethereum-core": "4.18.5",
|
|
28
|
+
"@dynamic-labs/logger": "4.18.5",
|
|
29
|
+
"@dynamic-labs/types": "4.18.5",
|
|
30
|
+
"@dynamic-labs/utils": "4.18.5",
|
|
31
|
+
"@dynamic-labs/wallet-book": "4.18.5",
|
|
32
|
+
"@dynamic-labs/wallet-connector-core": "4.18.5"
|
|
33
33
|
},
|
|
34
34
|
"peerDependencies": {
|
|
35
35
|
"viem": "^2.21.60"
|
package/src/ZeroDevConnector.cjs
CHANGED
|
@@ -251,15 +251,15 @@ class ZeroDevConnector extends ethereumAaCore.AccountAbstractionBaseConnector {
|
|
|
251
251
|
yield Promise.all(this.providersFromApi.map((provider) => _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
252
252
|
const { chain, clientId } = provider;
|
|
253
253
|
const [kernelClient, kernelClientWithSponsorship] = yield Promise.all([
|
|
254
|
-
this.
|
|
254
|
+
this.getOrCreateKernelClient({
|
|
255
255
|
chainId: chain,
|
|
256
|
-
paymaster:
|
|
256
|
+
paymaster: createEcdsaKernelAccountClient.PaymasterTypeEnum.NONE,
|
|
257
257
|
projectId: clientId,
|
|
258
258
|
signer,
|
|
259
259
|
}),
|
|
260
|
-
this.
|
|
260
|
+
this.getOrCreateKernelClient({
|
|
261
261
|
chainId: chain,
|
|
262
|
-
paymaster:
|
|
262
|
+
paymaster: createEcdsaKernelAccountClient.PaymasterTypeEnum.SPONSOR,
|
|
263
263
|
projectId: clientId,
|
|
264
264
|
signer,
|
|
265
265
|
}),
|
|
@@ -281,13 +281,8 @@ class ZeroDevConnector extends ethereumAaCore.AccountAbstractionBaseConnector {
|
|
|
281
281
|
});
|
|
282
282
|
}
|
|
283
283
|
createKernelClient(_a) {
|
|
284
|
-
return _tslib.__awaiter(this, arguments, void 0, function* ({ chainId, projectId, signer, paymaster, }) {
|
|
284
|
+
return _tslib.__awaiter(this, arguments, void 0, function* ({ chainId, projectId, signer, paymaster, paymasterRpcOverride, bundlerRpcOverride, }) {
|
|
285
285
|
var _b;
|
|
286
|
-
if (chainId && this.providerMap[chainId]) {
|
|
287
|
-
return paymaster === 'SPONSOR'
|
|
288
|
-
? this.providerMap[chainId].kernelClientWithSponsorship
|
|
289
|
-
: this.providerMap[chainId].kernelClient;
|
|
290
|
-
}
|
|
291
286
|
const { eoaConnector } = this;
|
|
292
287
|
if (!eoaConnector)
|
|
293
288
|
throw new utils.DynamicError('No EOA connector');
|
|
@@ -296,13 +291,13 @@ class ZeroDevConnector extends ethereumAaCore.AccountAbstractionBaseConnector {
|
|
|
296
291
|
const publicClientRpc = (_b = network === null || network === void 0 ? void 0 : network.privateCustomerRpcUrls) === null || _b === void 0 ? void 0 : _b[0];
|
|
297
292
|
let kernelClient;
|
|
298
293
|
const params = {
|
|
299
|
-
bundlerRpc: this.bundlerRpc,
|
|
294
|
+
bundlerRpc: bundlerRpcOverride !== null && bundlerRpcOverride !== void 0 ? bundlerRpcOverride : this.bundlerRpc,
|
|
300
295
|
chain,
|
|
301
296
|
enableKernelV3Migration: this.enableKernelV3Migration,
|
|
302
297
|
entryPoint: this.entryPoint,
|
|
303
298
|
kernelVersion: this.kernelVersion,
|
|
304
299
|
paymaster,
|
|
305
|
-
paymasterRpc: this.paymasterRpc,
|
|
300
|
+
paymasterRpc: paymasterRpcOverride !== null && paymasterRpcOverride !== void 0 ? paymasterRpcOverride : this.paymasterRpc,
|
|
306
301
|
projectId,
|
|
307
302
|
provider: this.bundlerProvider,
|
|
308
303
|
publicClientRpc,
|
|
@@ -321,6 +316,21 @@ class ZeroDevConnector extends ethereumAaCore.AccountAbstractionBaseConnector {
|
|
|
321
316
|
return kernelClient;
|
|
322
317
|
});
|
|
323
318
|
}
|
|
319
|
+
getOrCreateKernelClient(_a) {
|
|
320
|
+
return _tslib.__awaiter(this, arguments, void 0, function* ({ chainId, projectId, signer, paymaster, }) {
|
|
321
|
+
if (chainId && this.providerMap[chainId]) {
|
|
322
|
+
return paymaster === createEcdsaKernelAccountClient.PaymasterTypeEnum.SPONSOR
|
|
323
|
+
? this.providerMap[chainId].kernelClientWithSponsorship
|
|
324
|
+
: this.providerMap[chainId].kernelClient;
|
|
325
|
+
}
|
|
326
|
+
return this.createKernelClient({
|
|
327
|
+
chainId,
|
|
328
|
+
paymaster,
|
|
329
|
+
projectId,
|
|
330
|
+
signer,
|
|
331
|
+
});
|
|
332
|
+
});
|
|
333
|
+
}
|
|
324
334
|
getAddress() {
|
|
325
335
|
return _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
326
336
|
var _a, _b, _c;
|
|
@@ -347,8 +357,58 @@ class ZeroDevConnector extends ethereumAaCore.AccountAbstractionBaseConnector {
|
|
|
347
357
|
return Number(this.lastUsedChainId);
|
|
348
358
|
});
|
|
349
359
|
}
|
|
360
|
+
getCapabilities() {
|
|
361
|
+
return _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
362
|
+
const capabilities = {};
|
|
363
|
+
this.evmNetworks.forEach((network) => {
|
|
364
|
+
capabilities[utils.parseChainId(network.chainId)] = {
|
|
365
|
+
atomic: {
|
|
366
|
+
status: 'ready',
|
|
367
|
+
},
|
|
368
|
+
paymasterService: {
|
|
369
|
+
supported: true,
|
|
370
|
+
},
|
|
371
|
+
};
|
|
372
|
+
});
|
|
373
|
+
return capabilities;
|
|
374
|
+
});
|
|
375
|
+
}
|
|
376
|
+
sendCalls(callParams) {
|
|
377
|
+
return _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
378
|
+
var _a, _b, _c, _d, _e;
|
|
379
|
+
const { calls, capabilities, chain } = callParams;
|
|
380
|
+
const paymasterUrl = (chain === null || chain === void 0 ? void 0 : chain.id)
|
|
381
|
+
? (_b = (_a = capabilities === null || capabilities === void 0 ? void 0 : capabilities[chain.id]) === null || _a === void 0 ? void 0 : _a.paymasterService) === null || _b === void 0 ? void 0 : _b.url
|
|
382
|
+
: undefined;
|
|
383
|
+
const signer = yield this.eoaConnector.getSigner();
|
|
384
|
+
signer.account = accounts.toAccount(this.eoaAddress);
|
|
385
|
+
const chainId = (_d = (_c = chain === null || chain === void 0 ? void 0 : chain.id) === null || _c === void 0 ? void 0 : _c.toString()) !== null && _d !== void 0 ? _d : this.lastUsedChainId;
|
|
386
|
+
const clientId = (_e = this.providersFromApi.find((provider) => provider.chain === chainId)) === null || _e === void 0 ? void 0 : _e.clientId;
|
|
387
|
+
if (!clientId) {
|
|
388
|
+
throw new utils.DynamicError('No client id for chain id: ' + chainId);
|
|
389
|
+
}
|
|
390
|
+
const shouldSponsor = Boolean(ZeroDevConnector.defaultToKernelWithSponsorship || paymasterUrl);
|
|
391
|
+
const client = yield this.createKernelClient({
|
|
392
|
+
chainId,
|
|
393
|
+
paymaster: shouldSponsor
|
|
394
|
+
? createEcdsaKernelAccountClient.PaymasterTypeEnum.SPONSOR
|
|
395
|
+
: createEcdsaKernelAccountClient.PaymasterTypeEnum.NONE,
|
|
396
|
+
paymasterRpcOverride: paymasterUrl,
|
|
397
|
+
projectId: clientId,
|
|
398
|
+
signer,
|
|
399
|
+
});
|
|
400
|
+
if (!client) {
|
|
401
|
+
throw new utils.DynamicError('No kernel client');
|
|
402
|
+
}
|
|
403
|
+
const callData = yield client.account.encodeCalls(calls);
|
|
404
|
+
const hash = yield client.sendUserOperation({
|
|
405
|
+
callData,
|
|
406
|
+
});
|
|
407
|
+
return client.waitForUserOperationReceipt({ hash });
|
|
408
|
+
});
|
|
409
|
+
}
|
|
350
410
|
getTransport(provider) {
|
|
351
|
-
const
|
|
411
|
+
const transportWithConfirmationModal = ethereumCore.confirmationTransport({
|
|
352
412
|
getAccounts: () => _tslib.__awaiter(this, void 0, void 0, function* () { return [provider.account.address]; }),
|
|
353
413
|
onPersonalSign: (_a) => _tslib.__awaiter(this, [_a], void 0, function* ({ message }) {
|
|
354
414
|
this._walletUiUtils.disabledConfirmationOnce();
|
|
@@ -402,7 +462,15 @@ class ZeroDevConnector extends ethereumAaCore.AccountAbstractionBaseConnector {
|
|
|
402
462
|
walletConnector: this,
|
|
403
463
|
walletUiUtils: this._walletUiUtils,
|
|
404
464
|
});
|
|
405
|
-
|
|
465
|
+
const transportWithEip5792Support = ethereumCore.interceptTransport({
|
|
466
|
+
onGetCapabilities: () => _tslib.__awaiter(this, void 0, void 0, function* () { return this.getCapabilities(); }),
|
|
467
|
+
onSendCalls: (_d) => _tslib.__awaiter(this, [_d], void 0, function* ({ callParams }) {
|
|
468
|
+
const result = yield this.sendCalls(callParams);
|
|
469
|
+
return { id: result.userOpHash };
|
|
470
|
+
}),
|
|
471
|
+
transport: transportWithConfirmationModal,
|
|
472
|
+
});
|
|
473
|
+
return transportWithEip5792Support;
|
|
406
474
|
}
|
|
407
475
|
getWalletClient(chainId) {
|
|
408
476
|
const provider = this.kernelClient;
|
|
@@ -559,6 +627,16 @@ class ZeroDevConnector extends ethereumAaCore.AccountAbstractionBaseConnector {
|
|
|
559
627
|
return client.signMessage({ message: messageToSign });
|
|
560
628
|
});
|
|
561
629
|
}
|
|
630
|
+
signMessageForChain(messageToSign, chainId) {
|
|
631
|
+
return _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
632
|
+
var _a;
|
|
633
|
+
const client = (_a = this.providerMap[chainId]) === null || _a === void 0 ? void 0 : _a.kernelClient;
|
|
634
|
+
if (!client) {
|
|
635
|
+
throw new utils.DynamicError(`Provider for Chain ID ${chainId} not available. Please make sure that Chain ID ${chainId} is enabled in both the Dynamic dashboard and the ZeroDev dashboard.`);
|
|
636
|
+
}
|
|
637
|
+
return client.signMessage({ message: messageToSign });
|
|
638
|
+
});
|
|
639
|
+
}
|
|
562
640
|
validateActiveWallet(expectedAddress) {
|
|
563
641
|
return _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
564
642
|
if (this.shouldUseEIP7702Mode) {
|
|
@@ -592,11 +670,10 @@ class ZeroDevConnector extends ethereumAaCore.AccountAbstractionBaseConnector {
|
|
|
592
670
|
}
|
|
593
671
|
isPaymasterServiceSupported(chainId) {
|
|
594
672
|
return _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
595
|
-
logger.logger.debug('[ZeroDevConnector] isPaymasterServiceSupported -
|
|
673
|
+
logger.logger.debug('[ZeroDevConnector] isPaymasterServiceSupported - is supported', {
|
|
596
674
|
chainId,
|
|
597
675
|
});
|
|
598
|
-
|
|
599
|
-
return false;
|
|
676
|
+
return true;
|
|
600
677
|
});
|
|
601
678
|
}
|
|
602
679
|
}
|
|
@@ -46,6 +46,7 @@ export declare class ZeroDevConnector extends AccountAbstractionBaseConnector im
|
|
|
46
46
|
static bundlerRpcDefault: string | undefined;
|
|
47
47
|
static paymasterRpcDefault: string | undefined;
|
|
48
48
|
static kernelDelegationAddressDefault: `0x${string}` | undefined;
|
|
49
|
+
static defaultToKernelWithSponsorship: boolean | undefined;
|
|
49
50
|
/**
|
|
50
51
|
* Deferred promise that resolves when the ZeroDev provider is set.
|
|
51
52
|
* This is used to make sure that the provider is set before any other method is called.
|
|
@@ -119,9 +120,12 @@ export declare class ZeroDevConnector extends AccountAbstractionBaseConnector im
|
|
|
119
120
|
*/
|
|
120
121
|
private generateProviderMap;
|
|
121
122
|
private createKernelClient;
|
|
123
|
+
private getOrCreateKernelClient;
|
|
122
124
|
getAddress(): Promise<string | undefined>;
|
|
123
125
|
getConnectedAccounts(): Promise<string[]>;
|
|
124
126
|
getNetwork(): Promise<number | undefined>;
|
|
127
|
+
private getCapabilities;
|
|
128
|
+
private sendCalls;
|
|
125
129
|
private getTransport;
|
|
126
130
|
getWalletClient(chainId?: string): WalletClient<Transport, ViemChain, Account> | undefined;
|
|
127
131
|
getPublicClient(): Promise<void | PublicClient<Transport, ViemChain> | undefined>;
|
|
@@ -171,6 +175,7 @@ export declare class ZeroDevConnector extends AccountAbstractionBaseConnector im
|
|
|
171
175
|
}): Promise<boolean>;
|
|
172
176
|
getBalance(address: string): Promise<string | undefined>;
|
|
173
177
|
signMessage(messageToSign: string): Promise<string | undefined>;
|
|
178
|
+
signMessageForChain(messageToSign: string, chainId: string): Promise<string | undefined>;
|
|
174
179
|
validateActiveWallet(expectedAddress: string): Promise<void>;
|
|
175
180
|
isAtomicSupported(chainId?: number): Promise<boolean>;
|
|
176
181
|
isPaymasterServiceSupported(chainId?: number): Promise<boolean>;
|
package/src/ZeroDevConnector.js
CHANGED
|
@@ -4,13 +4,13 @@ import { KERNEL_V3_3, getEntryPoint as getEntryPoint$1 } from '@zerodev/sdk/cons
|
|
|
4
4
|
import { publicActions, custom, createWalletClient, toHex, formatEther } from 'viem';
|
|
5
5
|
import { toAccount } from 'viem/accounts';
|
|
6
6
|
import { AccountAbstractionBaseConnector } from '@dynamic-labs/ethereum-aa-core';
|
|
7
|
-
import { EthereumWallet, isEthWalletConnector, chainsMap, confirmationTransport, unFormatTransaction } from '@dynamic-labs/ethereum-core';
|
|
7
|
+
import { EthereumWallet, isEthWalletConnector, chainsMap, confirmationTransport, unFormatTransaction, interceptTransport } from '@dynamic-labs/ethereum-core';
|
|
8
8
|
import { ZerodevBundlerProvider, WalletProviderEnum } from '@dynamic-labs/sdk-api-core';
|
|
9
9
|
import { parseEvmNetworks, StorageService, DynamicError, DeferredPromise, parseChainId, wrapMethodWithCallback, TransactionGasCannotBeSponsoredError, InsufficientFundsError } from '@dynamic-labs/utils';
|
|
10
10
|
import { eventListenerHandlers, getWalletProvider } from '@dynamic-labs/wallet-connector-core';
|
|
11
11
|
import { ZERO_DEV_LAST_USED_CHAIN_ID_KEY } from './constants.js';
|
|
12
12
|
import { logger } from './utils/logger.js';
|
|
13
|
-
import { createEcdsaKernelAccountClientWith7702, createEcdsaKernelAccountClient } from './utils/createEcdsaKernelAccountClient.js';
|
|
13
|
+
import { PaymasterTypeEnum, createEcdsaKernelAccountClientWith7702, createEcdsaKernelAccountClient } from './utils/createEcdsaKernelAccountClient.js';
|
|
14
14
|
import { getEcdsaValidator } from './utils/getEcdsaValidator.js';
|
|
15
15
|
import { getEntryPoint } from './utils/getEntryPoint.js';
|
|
16
16
|
import { getKernelVersion } from './utils/getKernelVersion.js';
|
|
@@ -247,15 +247,15 @@ class ZeroDevConnector extends AccountAbstractionBaseConnector {
|
|
|
247
247
|
yield Promise.all(this.providersFromApi.map((provider) => __awaiter(this, void 0, void 0, function* () {
|
|
248
248
|
const { chain, clientId } = provider;
|
|
249
249
|
const [kernelClient, kernelClientWithSponsorship] = yield Promise.all([
|
|
250
|
-
this.
|
|
250
|
+
this.getOrCreateKernelClient({
|
|
251
251
|
chainId: chain,
|
|
252
|
-
paymaster:
|
|
252
|
+
paymaster: PaymasterTypeEnum.NONE,
|
|
253
253
|
projectId: clientId,
|
|
254
254
|
signer,
|
|
255
255
|
}),
|
|
256
|
-
this.
|
|
256
|
+
this.getOrCreateKernelClient({
|
|
257
257
|
chainId: chain,
|
|
258
|
-
paymaster:
|
|
258
|
+
paymaster: PaymasterTypeEnum.SPONSOR,
|
|
259
259
|
projectId: clientId,
|
|
260
260
|
signer,
|
|
261
261
|
}),
|
|
@@ -277,13 +277,8 @@ class ZeroDevConnector extends AccountAbstractionBaseConnector {
|
|
|
277
277
|
});
|
|
278
278
|
}
|
|
279
279
|
createKernelClient(_a) {
|
|
280
|
-
return __awaiter(this, arguments, void 0, function* ({ chainId, projectId, signer, paymaster, }) {
|
|
280
|
+
return __awaiter(this, arguments, void 0, function* ({ chainId, projectId, signer, paymaster, paymasterRpcOverride, bundlerRpcOverride, }) {
|
|
281
281
|
var _b;
|
|
282
|
-
if (chainId && this.providerMap[chainId]) {
|
|
283
|
-
return paymaster === 'SPONSOR'
|
|
284
|
-
? this.providerMap[chainId].kernelClientWithSponsorship
|
|
285
|
-
: this.providerMap[chainId].kernelClient;
|
|
286
|
-
}
|
|
287
282
|
const { eoaConnector } = this;
|
|
288
283
|
if (!eoaConnector)
|
|
289
284
|
throw new DynamicError('No EOA connector');
|
|
@@ -292,13 +287,13 @@ class ZeroDevConnector extends AccountAbstractionBaseConnector {
|
|
|
292
287
|
const publicClientRpc = (_b = network === null || network === void 0 ? void 0 : network.privateCustomerRpcUrls) === null || _b === void 0 ? void 0 : _b[0];
|
|
293
288
|
let kernelClient;
|
|
294
289
|
const params = {
|
|
295
|
-
bundlerRpc: this.bundlerRpc,
|
|
290
|
+
bundlerRpc: bundlerRpcOverride !== null && bundlerRpcOverride !== void 0 ? bundlerRpcOverride : this.bundlerRpc,
|
|
296
291
|
chain,
|
|
297
292
|
enableKernelV3Migration: this.enableKernelV3Migration,
|
|
298
293
|
entryPoint: this.entryPoint,
|
|
299
294
|
kernelVersion: this.kernelVersion,
|
|
300
295
|
paymaster,
|
|
301
|
-
paymasterRpc: this.paymasterRpc,
|
|
296
|
+
paymasterRpc: paymasterRpcOverride !== null && paymasterRpcOverride !== void 0 ? paymasterRpcOverride : this.paymasterRpc,
|
|
302
297
|
projectId,
|
|
303
298
|
provider: this.bundlerProvider,
|
|
304
299
|
publicClientRpc,
|
|
@@ -317,6 +312,21 @@ class ZeroDevConnector extends AccountAbstractionBaseConnector {
|
|
|
317
312
|
return kernelClient;
|
|
318
313
|
});
|
|
319
314
|
}
|
|
315
|
+
getOrCreateKernelClient(_a) {
|
|
316
|
+
return __awaiter(this, arguments, void 0, function* ({ chainId, projectId, signer, paymaster, }) {
|
|
317
|
+
if (chainId && this.providerMap[chainId]) {
|
|
318
|
+
return paymaster === PaymasterTypeEnum.SPONSOR
|
|
319
|
+
? this.providerMap[chainId].kernelClientWithSponsorship
|
|
320
|
+
: this.providerMap[chainId].kernelClient;
|
|
321
|
+
}
|
|
322
|
+
return this.createKernelClient({
|
|
323
|
+
chainId,
|
|
324
|
+
paymaster,
|
|
325
|
+
projectId,
|
|
326
|
+
signer,
|
|
327
|
+
});
|
|
328
|
+
});
|
|
329
|
+
}
|
|
320
330
|
getAddress() {
|
|
321
331
|
return __awaiter(this, void 0, void 0, function* () {
|
|
322
332
|
var _a, _b, _c;
|
|
@@ -343,8 +353,58 @@ class ZeroDevConnector extends AccountAbstractionBaseConnector {
|
|
|
343
353
|
return Number(this.lastUsedChainId);
|
|
344
354
|
});
|
|
345
355
|
}
|
|
356
|
+
getCapabilities() {
|
|
357
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
358
|
+
const capabilities = {};
|
|
359
|
+
this.evmNetworks.forEach((network) => {
|
|
360
|
+
capabilities[parseChainId(network.chainId)] = {
|
|
361
|
+
atomic: {
|
|
362
|
+
status: 'ready',
|
|
363
|
+
},
|
|
364
|
+
paymasterService: {
|
|
365
|
+
supported: true,
|
|
366
|
+
},
|
|
367
|
+
};
|
|
368
|
+
});
|
|
369
|
+
return capabilities;
|
|
370
|
+
});
|
|
371
|
+
}
|
|
372
|
+
sendCalls(callParams) {
|
|
373
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
374
|
+
var _a, _b, _c, _d, _e;
|
|
375
|
+
const { calls, capabilities, chain } = callParams;
|
|
376
|
+
const paymasterUrl = (chain === null || chain === void 0 ? void 0 : chain.id)
|
|
377
|
+
? (_b = (_a = capabilities === null || capabilities === void 0 ? void 0 : capabilities[chain.id]) === null || _a === void 0 ? void 0 : _a.paymasterService) === null || _b === void 0 ? void 0 : _b.url
|
|
378
|
+
: undefined;
|
|
379
|
+
const signer = yield this.eoaConnector.getSigner();
|
|
380
|
+
signer.account = toAccount(this.eoaAddress);
|
|
381
|
+
const chainId = (_d = (_c = chain === null || chain === void 0 ? void 0 : chain.id) === null || _c === void 0 ? void 0 : _c.toString()) !== null && _d !== void 0 ? _d : this.lastUsedChainId;
|
|
382
|
+
const clientId = (_e = this.providersFromApi.find((provider) => provider.chain === chainId)) === null || _e === void 0 ? void 0 : _e.clientId;
|
|
383
|
+
if (!clientId) {
|
|
384
|
+
throw new DynamicError('No client id for chain id: ' + chainId);
|
|
385
|
+
}
|
|
386
|
+
const shouldSponsor = Boolean(ZeroDevConnector.defaultToKernelWithSponsorship || paymasterUrl);
|
|
387
|
+
const client = yield this.createKernelClient({
|
|
388
|
+
chainId,
|
|
389
|
+
paymaster: shouldSponsor
|
|
390
|
+
? PaymasterTypeEnum.SPONSOR
|
|
391
|
+
: PaymasterTypeEnum.NONE,
|
|
392
|
+
paymasterRpcOverride: paymasterUrl,
|
|
393
|
+
projectId: clientId,
|
|
394
|
+
signer,
|
|
395
|
+
});
|
|
396
|
+
if (!client) {
|
|
397
|
+
throw new DynamicError('No kernel client');
|
|
398
|
+
}
|
|
399
|
+
const callData = yield client.account.encodeCalls(calls);
|
|
400
|
+
const hash = yield client.sendUserOperation({
|
|
401
|
+
callData,
|
|
402
|
+
});
|
|
403
|
+
return client.waitForUserOperationReceipt({ hash });
|
|
404
|
+
});
|
|
405
|
+
}
|
|
346
406
|
getTransport(provider) {
|
|
347
|
-
const
|
|
407
|
+
const transportWithConfirmationModal = confirmationTransport({
|
|
348
408
|
getAccounts: () => __awaiter(this, void 0, void 0, function* () { return [provider.account.address]; }),
|
|
349
409
|
onPersonalSign: (_a) => __awaiter(this, [_a], void 0, function* ({ message }) {
|
|
350
410
|
this._walletUiUtils.disabledConfirmationOnce();
|
|
@@ -398,7 +458,15 @@ class ZeroDevConnector extends AccountAbstractionBaseConnector {
|
|
|
398
458
|
walletConnector: this,
|
|
399
459
|
walletUiUtils: this._walletUiUtils,
|
|
400
460
|
});
|
|
401
|
-
|
|
461
|
+
const transportWithEip5792Support = interceptTransport({
|
|
462
|
+
onGetCapabilities: () => __awaiter(this, void 0, void 0, function* () { return this.getCapabilities(); }),
|
|
463
|
+
onSendCalls: (_d) => __awaiter(this, [_d], void 0, function* ({ callParams }) {
|
|
464
|
+
const result = yield this.sendCalls(callParams);
|
|
465
|
+
return { id: result.userOpHash };
|
|
466
|
+
}),
|
|
467
|
+
transport: transportWithConfirmationModal,
|
|
468
|
+
});
|
|
469
|
+
return transportWithEip5792Support;
|
|
402
470
|
}
|
|
403
471
|
getWalletClient(chainId) {
|
|
404
472
|
const provider = this.kernelClient;
|
|
@@ -555,6 +623,16 @@ class ZeroDevConnector extends AccountAbstractionBaseConnector {
|
|
|
555
623
|
return client.signMessage({ message: messageToSign });
|
|
556
624
|
});
|
|
557
625
|
}
|
|
626
|
+
signMessageForChain(messageToSign, chainId) {
|
|
627
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
628
|
+
var _a;
|
|
629
|
+
const client = (_a = this.providerMap[chainId]) === null || _a === void 0 ? void 0 : _a.kernelClient;
|
|
630
|
+
if (!client) {
|
|
631
|
+
throw new DynamicError(`Provider for Chain ID ${chainId} not available. Please make sure that Chain ID ${chainId} is enabled in both the Dynamic dashboard and the ZeroDev dashboard.`);
|
|
632
|
+
}
|
|
633
|
+
return client.signMessage({ message: messageToSign });
|
|
634
|
+
});
|
|
635
|
+
}
|
|
558
636
|
validateActiveWallet(expectedAddress) {
|
|
559
637
|
return __awaiter(this, void 0, void 0, function* () {
|
|
560
638
|
if (this.shouldUseEIP7702Mode) {
|
|
@@ -588,11 +666,10 @@ class ZeroDevConnector extends AccountAbstractionBaseConnector {
|
|
|
588
666
|
}
|
|
589
667
|
isPaymasterServiceSupported(chainId) {
|
|
590
668
|
return __awaiter(this, void 0, void 0, function* () {
|
|
591
|
-
logger.debug('[ZeroDevConnector] isPaymasterServiceSupported -
|
|
669
|
+
logger.debug('[ZeroDevConnector] isPaymasterServiceSupported - is supported', {
|
|
592
670
|
chainId,
|
|
593
671
|
});
|
|
594
|
-
|
|
595
|
-
return false;
|
|
672
|
+
return true;
|
|
596
673
|
});
|
|
597
674
|
}
|
|
598
675
|
}
|
package/src/index.cjs
CHANGED
|
@@ -18,11 +18,13 @@ assertPackageVersion.assertPackageVersion('@dynamic-labs/ethereum-aa', _package.
|
|
|
18
18
|
* Allows defining default values for zerodev configs.
|
|
19
19
|
* Values configured in the dashboard will take precedence over these values.
|
|
20
20
|
*/
|
|
21
|
-
const ZeroDevSmartWalletConnectorsWithConfig = ({ bundlerProvider, bundlerRpc, paymasterRpc, kernelDelegationAddress, } = {}) => {
|
|
21
|
+
const ZeroDevSmartWalletConnectorsWithConfig = ({ bundlerProvider, bundlerRpc, paymasterRpc, kernelDelegationAddress, defaultToKernelWithSponsorship, } = {}) => {
|
|
22
22
|
ZeroDevConnector.ZeroDevConnector.bundlerProviderDefault = bundlerProvider;
|
|
23
23
|
ZeroDevConnector.ZeroDevConnector.bundlerRpcDefault = bundlerRpc;
|
|
24
24
|
ZeroDevConnector.ZeroDevConnector.paymasterRpcDefault = paymasterRpc;
|
|
25
25
|
ZeroDevConnector.ZeroDevConnector.kernelDelegationAddressDefault = kernelDelegationAddress;
|
|
26
|
+
ZeroDevConnector.ZeroDevConnector.defaultToKernelWithSponsorship =
|
|
27
|
+
defaultToKernelWithSponsorship;
|
|
26
28
|
return ZeroDevSmartWalletConnectors;
|
|
27
29
|
};
|
|
28
30
|
const ZeroDevSmartWalletConnectors = (props) => {
|
|
@@ -33,6 +35,10 @@ const ZeroDevSmartWalletConnectors = (props) => {
|
|
|
33
35
|
return [];
|
|
34
36
|
};
|
|
35
37
|
|
|
38
|
+
Object.defineProperty(exports, 'PaymasterTypeEnum', {
|
|
39
|
+
enumerable: true,
|
|
40
|
+
get: function () { return createEcdsaKernelAccountClient.PaymasterTypeEnum; }
|
|
41
|
+
});
|
|
36
42
|
exports.createEcdsaKernelAccountClient = createEcdsaKernelAccountClient.createEcdsaKernelAccountClient;
|
|
37
43
|
exports.fetchZeroDevChain = fetchZeroDevChain.fetchZeroDevChain;
|
|
38
44
|
exports.getEcdsaValidator = getEcdsaValidator.getEcdsaValidator;
|
package/src/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ZerodevBundlerProvider } from '@dynamic-labs/sdk-api-core';
|
|
2
2
|
import { WalletConnectorConstructor } from '@dynamic-labs/wallet-connector-core';
|
|
3
|
-
export { createEcdsaKernelAccountClient, type PaymasterType, } from './utils/createEcdsaKernelAccountClient';
|
|
3
|
+
export { createEcdsaKernelAccountClient, type PaymasterType, PaymasterTypeEnum, } from './utils/createEcdsaKernelAccountClient';
|
|
4
4
|
export { fetchZeroDevChain } from './utils/fetchZeroDevChain';
|
|
5
5
|
export { getEcdsaValidator } from './utils/getEcdsaValidator';
|
|
6
6
|
export { getEntryPoint } from './utils/getEntryPoint';
|
|
@@ -13,10 +13,11 @@ ZerodevBundlerProvider as BundlerProvider, } from '@dynamic-labs/sdk-api-core';
|
|
|
13
13
|
* Allows defining default values for zerodev configs.
|
|
14
14
|
* Values configured in the dashboard will take precedence over these values.
|
|
15
15
|
*/
|
|
16
|
-
export declare const ZeroDevSmartWalletConnectorsWithConfig: ({ bundlerProvider, bundlerRpc, paymasterRpc, kernelDelegationAddress, }?: {
|
|
16
|
+
export declare const ZeroDevSmartWalletConnectorsWithConfig: ({ bundlerProvider, bundlerRpc, paymasterRpc, kernelDelegationAddress, defaultToKernelWithSponsorship, }?: {
|
|
17
17
|
bundlerProvider?: ZerodevBundlerProvider;
|
|
18
18
|
bundlerRpc?: string;
|
|
19
19
|
paymasterRpc?: string;
|
|
20
20
|
kernelDelegationAddress?: `0x${string}`;
|
|
21
|
+
defaultToKernelWithSponsorship?: boolean;
|
|
21
22
|
}) => (props: any) => WalletConnectorConstructor[];
|
|
22
23
|
export declare const ZeroDevSmartWalletConnectors: (props: any) => WalletConnectorConstructor[];
|
package/src/index.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { assertPackageVersion } from '@dynamic-labs/assert-package-version';
|
|
3
3
|
import { version } from '../package.js';
|
|
4
4
|
import { ZeroDevConnector } from './ZeroDevConnector.js';
|
|
5
|
-
export { createEcdsaKernelAccountClient } from './utils/createEcdsaKernelAccountClient.js';
|
|
5
|
+
export { PaymasterTypeEnum, createEcdsaKernelAccountClient } from './utils/createEcdsaKernelAccountClient.js';
|
|
6
6
|
export { fetchZeroDevChain } from './utils/fetchZeroDevChain.js';
|
|
7
7
|
export { getEcdsaValidator } from './utils/getEcdsaValidator.js';
|
|
8
8
|
export { getEntryPoint } from './utils/getEntryPoint.js';
|
|
@@ -14,11 +14,13 @@ assertPackageVersion('@dynamic-labs/ethereum-aa', version);
|
|
|
14
14
|
* Allows defining default values for zerodev configs.
|
|
15
15
|
* Values configured in the dashboard will take precedence over these values.
|
|
16
16
|
*/
|
|
17
|
-
const ZeroDevSmartWalletConnectorsWithConfig = ({ bundlerProvider, bundlerRpc, paymasterRpc, kernelDelegationAddress, } = {}) => {
|
|
17
|
+
const ZeroDevSmartWalletConnectorsWithConfig = ({ bundlerProvider, bundlerRpc, paymasterRpc, kernelDelegationAddress, defaultToKernelWithSponsorship, } = {}) => {
|
|
18
18
|
ZeroDevConnector.bundlerProviderDefault = bundlerProvider;
|
|
19
19
|
ZeroDevConnector.bundlerRpcDefault = bundlerRpc;
|
|
20
20
|
ZeroDevConnector.paymasterRpcDefault = paymasterRpc;
|
|
21
21
|
ZeroDevConnector.kernelDelegationAddressDefault = kernelDelegationAddress;
|
|
22
|
+
ZeroDevConnector.defaultToKernelWithSponsorship =
|
|
23
|
+
defaultToKernelWithSponsorship;
|
|
22
24
|
return ZeroDevSmartWalletConnectors;
|
|
23
25
|
};
|
|
24
26
|
const ZeroDevSmartWalletConnectors = (props) => {
|
|
@@ -11,6 +11,11 @@ var viem = require('viem');
|
|
|
11
11
|
var ecdsaValidator = require('@zerodev/ecdsa-validator');
|
|
12
12
|
var constants = require('@zerodev/sdk/constants');
|
|
13
13
|
|
|
14
|
+
exports.PaymasterTypeEnum = void 0;
|
|
15
|
+
(function (PaymasterTypeEnum) {
|
|
16
|
+
PaymasterTypeEnum["NONE"] = "NONE";
|
|
17
|
+
PaymasterTypeEnum["SPONSOR"] = "SPONSOR";
|
|
18
|
+
})(exports.PaymasterTypeEnum || (exports.PaymasterTypeEnum = {}));
|
|
14
19
|
const getZeroDevBundlerRPC = (projectId, provider) => {
|
|
15
20
|
let rpc = `https://rpc.zerodev.app/api/v2/bundler/${projectId}`;
|
|
16
21
|
if (provider) {
|
|
@@ -38,7 +43,7 @@ const createPublicAndPaymasterClients = (bundlerRpc, paymasterRpc, chain, public
|
|
|
38
43
|
return { publicClient, zerodevPaymaster };
|
|
39
44
|
};
|
|
40
45
|
const createPaymasterHandler = (paymaster, zerodevPaymaster) => {
|
|
41
|
-
if (paymaster ===
|
|
46
|
+
if (paymaster === exports.PaymasterTypeEnum.NONE)
|
|
42
47
|
return undefined;
|
|
43
48
|
return {
|
|
44
49
|
getPaymasterData: (userOperation) => {
|
|
@@ -65,7 +70,7 @@ const createKernelClientConfig = (account, bundlerRpc, chain, publicClient, paym
|
|
|
65
70
|
estimateFeesPerGas: (_a) => _tslib.__awaiter(void 0, [_a], void 0, function* ({ bundlerClient }) { return actions.getUserOperationGasPrice(bundlerClient); }),
|
|
66
71
|
},
|
|
67
72
|
});
|
|
68
|
-
const createEcdsaKernelAccountClient = (_b) => _tslib.__awaiter(void 0, [_b], void 0, function* ({ bundlerRpc, chain, paymasterRpc, projectId, signer, provider, paymaster =
|
|
73
|
+
const createEcdsaKernelAccountClient = (_b) => _tslib.__awaiter(void 0, [_b], void 0, function* ({ bundlerRpc, chain, paymasterRpc, projectId, signer, provider, paymaster = exports.PaymasterTypeEnum.SPONSOR, entryPoint, kernelVersion, ecdsaValidator: ecdsaValidator$1, enableKernelV3Migration, publicClientRpc, }) {
|
|
69
74
|
const resolvedBundlerRpc = bundlerRpc !== null && bundlerRpc !== void 0 ? bundlerRpc : getZeroDevBundlerRPC(projectId, provider);
|
|
70
75
|
const resolvedPaymasterRpc = paymasterRpc !== null && paymasterRpc !== void 0 ? paymasterRpc : getZeroDevPaymasterRPC(projectId, provider);
|
|
71
76
|
const { publicClient, zerodevPaymaster } = createPublicAndPaymasterClients(resolvedBundlerRpc, resolvedPaymasterRpc, chain, publicClientRpc);
|
|
@@ -97,14 +102,14 @@ const createEcdsaKernelAccountClient = (_b) => _tslib.__awaiter(void 0, [_b], vo
|
|
|
97
102
|
const clientConfig = createKernelClientConfig(selectedAccount, resolvedBundlerRpc, chain, publicClient, paymasterHandler);
|
|
98
103
|
return clients.createKernelAccountClient(clientConfig);
|
|
99
104
|
});
|
|
100
|
-
const createEcdsaKernelAccountClientWith7702 = (_c) => _tslib.__awaiter(void 0, [_c], void 0, function* ({ bundlerRpc, chain, paymasterRpc, projectId, signer, provider, paymaster =
|
|
105
|
+
const createEcdsaKernelAccountClientWith7702 = (_c) => _tslib.__awaiter(void 0, [_c], void 0, function* ({ bundlerRpc, chain, paymasterRpc, projectId, signer, provider, paymaster = exports.PaymasterTypeEnum.SPONSOR, entryPoint, kernelVersion, publicClientRpc, }) {
|
|
101
106
|
const resolvedBundlerRpc = bundlerRpc !== null && bundlerRpc !== void 0 ? bundlerRpc : getZeroDevBundlerRPC(projectId, provider);
|
|
102
107
|
const resolvedPaymasterRpc = paymasterRpc !== null && paymasterRpc !== void 0 ? paymasterRpc : getZeroDevPaymasterRPC(projectId, provider);
|
|
103
108
|
const { publicClient, zerodevPaymaster } = createPublicAndPaymasterClients(resolvedBundlerRpc, resolvedPaymasterRpc, chain, publicClientRpc);
|
|
104
109
|
const account = yield ecdsaValidator.create7702KernelAccount(publicClient, {
|
|
105
110
|
entryPoint,
|
|
106
111
|
kernelVersion,
|
|
107
|
-
signer
|
|
112
|
+
signer,
|
|
108
113
|
});
|
|
109
114
|
const paymasterHandler = createPaymasterHandler(paymaster, zerodevPaymaster);
|
|
110
115
|
const kernelClient = ecdsaValidator.create7702KernelAccountClient({
|
|
@@ -5,7 +5,11 @@ import { Address, WalletClient, Account, type Chain, type Client, type RpcSchema
|
|
|
5
5
|
import { EntryPointType, GetKernelVersion } from '@zerodev/sdk/types';
|
|
6
6
|
import { ZerodevBundlerProvider } from '@dynamic-labs/sdk-api-core';
|
|
7
7
|
export type ERC20Paymaster = Address;
|
|
8
|
-
export type PaymasterType =
|
|
8
|
+
export type PaymasterType = keyof typeof PaymasterTypeEnum | ERC20Paymaster;
|
|
9
|
+
export declare enum PaymasterTypeEnum {
|
|
10
|
+
NONE = "NONE",
|
|
11
|
+
SPONSOR = "SPONSOR"
|
|
12
|
+
}
|
|
9
13
|
export declare const getZeroDevBundlerRPC: (projectId: string, provider?: ZerodevBundlerProvider) => string;
|
|
10
14
|
export declare const getZeroDevPaymasterRPC: (projectId: string, provider?: ZerodevBundlerProvider) => string;
|
|
11
15
|
type CommonClientParams<TChain extends Chain | undefined = Chain | undefined> = {
|
|
@@ -7,6 +7,11 @@ import { createPublicClient, http, isAddress } from 'viem';
|
|
|
7
7
|
import { createEcdsaKernelMigrationAccount, create7702KernelAccount, create7702KernelAccountClient } from '@zerodev/ecdsa-validator';
|
|
8
8
|
import { KERNEL_V3_1 } from '@zerodev/sdk/constants';
|
|
9
9
|
|
|
10
|
+
var PaymasterTypeEnum;
|
|
11
|
+
(function (PaymasterTypeEnum) {
|
|
12
|
+
PaymasterTypeEnum["NONE"] = "NONE";
|
|
13
|
+
PaymasterTypeEnum["SPONSOR"] = "SPONSOR";
|
|
14
|
+
})(PaymasterTypeEnum || (PaymasterTypeEnum = {}));
|
|
10
15
|
const getZeroDevBundlerRPC = (projectId, provider) => {
|
|
11
16
|
let rpc = `https://rpc.zerodev.app/api/v2/bundler/${projectId}`;
|
|
12
17
|
if (provider) {
|
|
@@ -34,7 +39,7 @@ const createPublicAndPaymasterClients = (bundlerRpc, paymasterRpc, chain, public
|
|
|
34
39
|
return { publicClient, zerodevPaymaster };
|
|
35
40
|
};
|
|
36
41
|
const createPaymasterHandler = (paymaster, zerodevPaymaster) => {
|
|
37
|
-
if (paymaster ===
|
|
42
|
+
if (paymaster === PaymasterTypeEnum.NONE)
|
|
38
43
|
return undefined;
|
|
39
44
|
return {
|
|
40
45
|
getPaymasterData: (userOperation) => {
|
|
@@ -61,7 +66,7 @@ const createKernelClientConfig = (account, bundlerRpc, chain, publicClient, paym
|
|
|
61
66
|
estimateFeesPerGas: (_a) => __awaiter(void 0, [_a], void 0, function* ({ bundlerClient }) { return getUserOperationGasPrice(bundlerClient); }),
|
|
62
67
|
},
|
|
63
68
|
});
|
|
64
|
-
const createEcdsaKernelAccountClient = (_b) => __awaiter(void 0, [_b], void 0, function* ({ bundlerRpc, chain, paymasterRpc, projectId, signer, provider, paymaster =
|
|
69
|
+
const createEcdsaKernelAccountClient = (_b) => __awaiter(void 0, [_b], void 0, function* ({ bundlerRpc, chain, paymasterRpc, projectId, signer, provider, paymaster = PaymasterTypeEnum.SPONSOR, entryPoint, kernelVersion, ecdsaValidator, enableKernelV3Migration, publicClientRpc, }) {
|
|
65
70
|
const resolvedBundlerRpc = bundlerRpc !== null && bundlerRpc !== void 0 ? bundlerRpc : getZeroDevBundlerRPC(projectId, provider);
|
|
66
71
|
const resolvedPaymasterRpc = paymasterRpc !== null && paymasterRpc !== void 0 ? paymasterRpc : getZeroDevPaymasterRPC(projectId, provider);
|
|
67
72
|
const { publicClient, zerodevPaymaster } = createPublicAndPaymasterClients(resolvedBundlerRpc, resolvedPaymasterRpc, chain, publicClientRpc);
|
|
@@ -93,14 +98,14 @@ const createEcdsaKernelAccountClient = (_b) => __awaiter(void 0, [_b], void 0, f
|
|
|
93
98
|
const clientConfig = createKernelClientConfig(selectedAccount, resolvedBundlerRpc, chain, publicClient, paymasterHandler);
|
|
94
99
|
return createKernelAccountClient(clientConfig);
|
|
95
100
|
});
|
|
96
|
-
const createEcdsaKernelAccountClientWith7702 = (_c) => __awaiter(void 0, [_c], void 0, function* ({ bundlerRpc, chain, paymasterRpc, projectId, signer, provider, paymaster =
|
|
101
|
+
const createEcdsaKernelAccountClientWith7702 = (_c) => __awaiter(void 0, [_c], void 0, function* ({ bundlerRpc, chain, paymasterRpc, projectId, signer, provider, paymaster = PaymasterTypeEnum.SPONSOR, entryPoint, kernelVersion, publicClientRpc, }) {
|
|
97
102
|
const resolvedBundlerRpc = bundlerRpc !== null && bundlerRpc !== void 0 ? bundlerRpc : getZeroDevBundlerRPC(projectId, provider);
|
|
98
103
|
const resolvedPaymasterRpc = paymasterRpc !== null && paymasterRpc !== void 0 ? paymasterRpc : getZeroDevPaymasterRPC(projectId, provider);
|
|
99
104
|
const { publicClient, zerodevPaymaster } = createPublicAndPaymasterClients(resolvedBundlerRpc, resolvedPaymasterRpc, chain, publicClientRpc);
|
|
100
105
|
const account = yield create7702KernelAccount(publicClient, {
|
|
101
106
|
entryPoint,
|
|
102
107
|
kernelVersion,
|
|
103
|
-
signer
|
|
108
|
+
signer,
|
|
104
109
|
});
|
|
105
110
|
const paymasterHandler = createPaymasterHandler(paymaster, zerodevPaymaster);
|
|
106
111
|
const kernelClient = create7702KernelAccountClient({
|
|
@@ -116,4 +121,4 @@ const createEcdsaKernelAccountClientWith7702 = (_c) => __awaiter(void 0, [_c], v
|
|
|
116
121
|
return kernelClient;
|
|
117
122
|
});
|
|
118
123
|
|
|
119
|
-
export { createEcdsaKernelAccountClient, createEcdsaKernelAccountClientWith7702, getZeroDevBundlerRPC, getZeroDevPaymasterRPC };
|
|
124
|
+
export { PaymasterTypeEnum, createEcdsaKernelAccountClient, createEcdsaKernelAccountClientWith7702, getZeroDevBundlerRPC, getZeroDevPaymasterRPC };
|