@dynamic-labs/ethereum-aa 4.87.0 → 4.87.2
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 +11 -0
- package/package.cjs +1 -1
- package/package.js +1 -1
- package/package.json +10 -10
- package/src/ZeroDevConnector.cjs +10 -7
- package/src/ZeroDevConnector.d.ts +1 -0
- package/src/ZeroDevConnector.js +10 -7
- package/src/utils/createEcdsaKernelAccountClient.cjs +20 -16
- package/src/utils/createEcdsaKernelAccountClient.d.ts +6 -4
- package/src/utils/createEcdsaKernelAccountClient.js +20 -16
package/CHANGELOG.md
CHANGED
|
@@ -1,4 +1,15 @@
|
|
|
1
1
|
|
|
2
|
+
### [4.87.2](https://github.com/dynamic-labs/dynamic-auth/compare/v4.87.1...v4.87.2) (2026-06-03)
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
### Bug Fixes
|
|
6
|
+
|
|
7
|
+
* allow for using v2 zerodev projects ([#11449](https://github.com/dynamic-labs/dynamic-auth/issues/11449)) ([9242698](https://github.com/dynamic-labs/dynamic-auth/commit/9242698670db92b03ad1afc776e674ec9a7e7e54))
|
|
8
|
+
* e2e: ensure MFA item is detached before logout ([#11452](https://github.com/dynamic-labs/dynamic-auth/issues/11452)) ([5a4c67e](https://github.com/dynamic-labs/dynamic-auth/commit/5a4c67e93b66a548346c1065fb373c675f0054a0))
|
|
9
|
+
|
|
10
|
+
### [4.87.1](https://github.com/dynamic-labs/dynamic-auth/compare/v4.87.0...v4.87.1) (2026-06-03)
|
|
11
|
+
|
|
12
|
+
|
|
2
13
|
## [4.87.0](https://github.com/dynamic-labs/dynamic-auth/compare/v4.86.0...v4.87.0) (2026-06-02)
|
|
3
14
|
|
|
4
15
|
|
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.87.
|
|
3
|
+
"version": "4.87.2",
|
|
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.1015",
|
|
22
22
|
"@zerodev/ecdsa-validator": "5.4.9",
|
|
23
23
|
"@zerodev/multi-chain-ecdsa-validator": "5.4.5",
|
|
24
24
|
"@zerodev/sdk": "5.5.7",
|
|
25
|
-
"@dynamic-labs/assert-package-version": "4.87.
|
|
26
|
-
"@dynamic-labs/ethereum-aa-core": "4.87.
|
|
27
|
-
"@dynamic-labs/ethereum-core": "4.87.
|
|
28
|
-
"@dynamic-labs/logger": "4.87.
|
|
29
|
-
"@dynamic-labs/types": "4.87.
|
|
30
|
-
"@dynamic-labs/utils": "4.87.
|
|
31
|
-
"@dynamic-labs/wallet-book": "4.87.
|
|
32
|
-
"@dynamic-labs/wallet-connector-core": "4.87.
|
|
25
|
+
"@dynamic-labs/assert-package-version": "4.87.2",
|
|
26
|
+
"@dynamic-labs/ethereum-aa-core": "4.87.2",
|
|
27
|
+
"@dynamic-labs/ethereum-core": "4.87.2",
|
|
28
|
+
"@dynamic-labs/logger": "4.87.2",
|
|
29
|
+
"@dynamic-labs/types": "4.87.2",
|
|
30
|
+
"@dynamic-labs/utils": "4.87.2",
|
|
31
|
+
"@dynamic-labs/wallet-book": "4.87.2",
|
|
32
|
+
"@dynamic-labs/wallet-connector-core": "4.87.2"
|
|
33
33
|
},
|
|
34
34
|
"peerDependencies": {
|
|
35
35
|
"viem": "^2.45.3"
|
package/src/ZeroDevConnector.cjs
CHANGED
|
@@ -23,7 +23,7 @@ var signEip7702Authorization = require('./utils/signEip7702Authorization/signEip
|
|
|
23
23
|
|
|
24
24
|
class ZeroDevConnector extends ethereumAaCore.AccountAbstractionBaseConnector {
|
|
25
25
|
constructor(opts) {
|
|
26
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u;
|
|
26
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v;
|
|
27
27
|
super(opts);
|
|
28
28
|
// Provider map maintains kernel clients per wallet address and chain
|
|
29
29
|
// Structure: { [walletAddress]: { [chainId]: { kernelClient, ... } } }
|
|
@@ -63,15 +63,16 @@ class ZeroDevConnector extends ethereumAaCore.AccountAbstractionBaseConnector {
|
|
|
63
63
|
(_j = (_h = opts.apiProviders.zerodev) === null || _h === void 0 ? void 0 : _h.zerodevBundlerRpcUrl) !== null && _j !== void 0 ? _j : ZeroDevConnector.bundlerRpcDefault;
|
|
64
64
|
this.paymasterRpc =
|
|
65
65
|
(_l = (_k = opts.apiProviders.zerodev) === null || _k === void 0 ? void 0 : _k.zerodevPaymasterRpcUrl) !== null && _l !== void 0 ? _l : ZeroDevConnector.paymasterRpcDefault;
|
|
66
|
+
this.projectVersion = (_m = opts.apiProviders.zerodev) === null || _m === void 0 ? void 0 : _m.zerodevProjectVersion;
|
|
66
67
|
this.kernelDelegationAddress =
|
|
67
|
-
(
|
|
68
|
-
this.apiKernelVersion = getKernelVersion.getKernelVersion((
|
|
69
|
-
this.kernelVersion = getKernelVersion.getKernelVersion((
|
|
68
|
+
(_p = (_o = opts.apiProviders.zerodev) === null || _o === void 0 ? void 0 : _o.zerodevKernelDelegationAddress) !== null && _p !== void 0 ? _p : ZeroDevConnector.kernelDelegationAddressDefault;
|
|
69
|
+
this.apiKernelVersion = getKernelVersion.getKernelVersion((_q = opts.apiProviders.zerodev) === null || _q === void 0 ? void 0 : _q.kernelVersion, this.entryPoint);
|
|
70
|
+
this.kernelVersion = getKernelVersion.getKernelVersion((_r = opts.apiProviders.zerodev) === null || _r === void 0 ? void 0 : _r.kernelVersion, this.entryPoint);
|
|
70
71
|
this.enableKernelV3Migration =
|
|
71
|
-
(
|
|
72
|
+
(_t = (_s = opts.apiProviders.zerodev) === null || _s === void 0 ? void 0 : _s.enableKernelV3Migration) !== null && _t !== void 0 ? _t : false;
|
|
72
73
|
// this is the list of providers from the api that are used for multi-chain account abstraction
|
|
73
74
|
this.providersFromApi =
|
|
74
|
-
((
|
|
75
|
+
((_u = opts.apiProviders.zerodev) === null || _u === void 0 ? void 0 : _u.multichainAccountAbstractionProviders) || [];
|
|
75
76
|
const enabledZerodevNetworks = this.providersFromApi.map((provider) => provider.chain);
|
|
76
77
|
this.evmNetworks = utils.parseEvmNetworks(opts.evmNetworks).filter((network) => enabledZerodevNetworks.includes(network.chainId.toString()));
|
|
77
78
|
const [defaultProvider] = this.providersFromApi;
|
|
@@ -80,7 +81,7 @@ class ZeroDevConnector extends ethereumAaCore.AccountAbstractionBaseConnector {
|
|
|
80
81
|
throw new Error('Missing ZeroDev project ID provided. Add your ZeroDev project id to your project configuration via the Dynamic Labs dashboard.');
|
|
81
82
|
}
|
|
82
83
|
this.defaultChainId = defaultProvider === null || defaultProvider === void 0 ? void 0 : defaultProvider.chain;
|
|
83
|
-
this.ecdsaProviderType = (
|
|
84
|
+
this.ecdsaProviderType = (_v = opts.apiProviders.zerodev) === null || _v === void 0 ? void 0 : _v.ecdsaProviderType;
|
|
84
85
|
}
|
|
85
86
|
confirmTransactionStatus() {
|
|
86
87
|
throw new Error('confirmTransactionStatus not implemented in ZeroDevConnector');
|
|
@@ -388,12 +389,14 @@ class ZeroDevConnector extends ethereumAaCore.AccountAbstractionBaseConnector {
|
|
|
388
389
|
apiKernelVersion: this.apiKernelVersion,
|
|
389
390
|
bundlerRpc: bundlerRpcOverride !== null && bundlerRpcOverride !== void 0 ? bundlerRpcOverride : this.bundlerRpc,
|
|
390
391
|
chain,
|
|
392
|
+
chainId: utils.parseChainId(chainId),
|
|
391
393
|
enableKernelV3Migration: this.enableKernelV3Migration,
|
|
392
394
|
entryPoint: this.entryPoint,
|
|
393
395
|
kernelVersion: this.kernelVersion,
|
|
394
396
|
paymaster,
|
|
395
397
|
paymasterRpc: paymasterRpcOverride !== null && paymasterRpcOverride !== void 0 ? paymasterRpcOverride : this.paymasterRpc,
|
|
396
398
|
projectId,
|
|
399
|
+
projectVersion: this.projectVersion,
|
|
397
400
|
provider: this.bundlerProvider,
|
|
398
401
|
publicClientRpc: this.getPublicRpcForChain(chainId),
|
|
399
402
|
signer,
|
|
@@ -32,6 +32,7 @@ export declare class ZeroDevConnector extends AccountAbstractionBaseConnector im
|
|
|
32
32
|
bundlerProvider: ZerodevBundlerProvider;
|
|
33
33
|
bundlerRpc: string | undefined;
|
|
34
34
|
paymasterRpc: string | undefined;
|
|
35
|
+
projectVersion: string | undefined;
|
|
35
36
|
kernelDelegationAddress: `0x${string}` | undefined;
|
|
36
37
|
static bundlerProviderDefault: ZerodevBundlerProvider | undefined;
|
|
37
38
|
static bundlerRpcDefault: string | undefined;
|
package/src/ZeroDevConnector.js
CHANGED
|
@@ -19,7 +19,7 @@ import { signEip7702Authorization } from './utils/signEip7702Authorization/signE
|
|
|
19
19
|
|
|
20
20
|
class ZeroDevConnector extends AccountAbstractionBaseConnector {
|
|
21
21
|
constructor(opts) {
|
|
22
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u;
|
|
22
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v;
|
|
23
23
|
super(opts);
|
|
24
24
|
// Provider map maintains kernel clients per wallet address and chain
|
|
25
25
|
// Structure: { [walletAddress]: { [chainId]: { kernelClient, ... } } }
|
|
@@ -59,15 +59,16 @@ class ZeroDevConnector extends AccountAbstractionBaseConnector {
|
|
|
59
59
|
(_j = (_h = opts.apiProviders.zerodev) === null || _h === void 0 ? void 0 : _h.zerodevBundlerRpcUrl) !== null && _j !== void 0 ? _j : ZeroDevConnector.bundlerRpcDefault;
|
|
60
60
|
this.paymasterRpc =
|
|
61
61
|
(_l = (_k = opts.apiProviders.zerodev) === null || _k === void 0 ? void 0 : _k.zerodevPaymasterRpcUrl) !== null && _l !== void 0 ? _l : ZeroDevConnector.paymasterRpcDefault;
|
|
62
|
+
this.projectVersion = (_m = opts.apiProviders.zerodev) === null || _m === void 0 ? void 0 : _m.zerodevProjectVersion;
|
|
62
63
|
this.kernelDelegationAddress =
|
|
63
|
-
(
|
|
64
|
-
this.apiKernelVersion = getKernelVersion((
|
|
65
|
-
this.kernelVersion = getKernelVersion((
|
|
64
|
+
(_p = (_o = opts.apiProviders.zerodev) === null || _o === void 0 ? void 0 : _o.zerodevKernelDelegationAddress) !== null && _p !== void 0 ? _p : ZeroDevConnector.kernelDelegationAddressDefault;
|
|
65
|
+
this.apiKernelVersion = getKernelVersion((_q = opts.apiProviders.zerodev) === null || _q === void 0 ? void 0 : _q.kernelVersion, this.entryPoint);
|
|
66
|
+
this.kernelVersion = getKernelVersion((_r = opts.apiProviders.zerodev) === null || _r === void 0 ? void 0 : _r.kernelVersion, this.entryPoint);
|
|
66
67
|
this.enableKernelV3Migration =
|
|
67
|
-
(
|
|
68
|
+
(_t = (_s = opts.apiProviders.zerodev) === null || _s === void 0 ? void 0 : _s.enableKernelV3Migration) !== null && _t !== void 0 ? _t : false;
|
|
68
69
|
// this is the list of providers from the api that are used for multi-chain account abstraction
|
|
69
70
|
this.providersFromApi =
|
|
70
|
-
((
|
|
71
|
+
((_u = opts.apiProviders.zerodev) === null || _u === void 0 ? void 0 : _u.multichainAccountAbstractionProviders) || [];
|
|
71
72
|
const enabledZerodevNetworks = this.providersFromApi.map((provider) => provider.chain);
|
|
72
73
|
this.evmNetworks = parseEvmNetworks(opts.evmNetworks).filter((network) => enabledZerodevNetworks.includes(network.chainId.toString()));
|
|
73
74
|
const [defaultProvider] = this.providersFromApi;
|
|
@@ -76,7 +77,7 @@ class ZeroDevConnector extends AccountAbstractionBaseConnector {
|
|
|
76
77
|
throw new Error('Missing ZeroDev project ID provided. Add your ZeroDev project id to your project configuration via the Dynamic Labs dashboard.');
|
|
77
78
|
}
|
|
78
79
|
this.defaultChainId = defaultProvider === null || defaultProvider === void 0 ? void 0 : defaultProvider.chain;
|
|
79
|
-
this.ecdsaProviderType = (
|
|
80
|
+
this.ecdsaProviderType = (_v = opts.apiProviders.zerodev) === null || _v === void 0 ? void 0 : _v.ecdsaProviderType;
|
|
80
81
|
}
|
|
81
82
|
confirmTransactionStatus() {
|
|
82
83
|
throw new Error('confirmTransactionStatus not implemented in ZeroDevConnector');
|
|
@@ -384,12 +385,14 @@ class ZeroDevConnector extends AccountAbstractionBaseConnector {
|
|
|
384
385
|
apiKernelVersion: this.apiKernelVersion,
|
|
385
386
|
bundlerRpc: bundlerRpcOverride !== null && bundlerRpcOverride !== void 0 ? bundlerRpcOverride : this.bundlerRpc,
|
|
386
387
|
chain,
|
|
388
|
+
chainId: parseChainId(chainId),
|
|
387
389
|
enableKernelV3Migration: this.enableKernelV3Migration,
|
|
388
390
|
entryPoint: this.entryPoint,
|
|
389
391
|
kernelVersion: this.kernelVersion,
|
|
390
392
|
paymaster,
|
|
391
393
|
paymasterRpc: paymasterRpcOverride !== null && paymasterRpcOverride !== void 0 ? paymasterRpcOverride : this.paymasterRpc,
|
|
392
394
|
projectId,
|
|
395
|
+
projectVersion: this.projectVersion,
|
|
393
396
|
provider: this.bundlerProvider,
|
|
394
397
|
publicClientRpc: this.getPublicRpcForChain(chainId),
|
|
395
398
|
signer,
|
|
@@ -15,19 +15,21 @@ exports.PaymasterTypeEnum = void 0;
|
|
|
15
15
|
PaymasterTypeEnum["NONE"] = "NONE";
|
|
16
16
|
PaymasterTypeEnum["SPONSOR"] = "SPONSOR";
|
|
17
17
|
})(exports.PaymasterTypeEnum || (exports.PaymasterTypeEnum = {}));
|
|
18
|
-
const getZeroDevBundlerRPC = (projectId, provider) => {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
18
|
+
const getZeroDevBundlerRPC = (projectId, chainId, projectVersion, provider) => {
|
|
19
|
+
if (projectVersion === 'v2' && chainId) {
|
|
20
|
+
const base = `https://rpc.zerodev.app/api/v3/${projectId}/chain/${chainId}`;
|
|
21
|
+
return provider ? `${base}?provider=${provider}` : base;
|
|
22
22
|
}
|
|
23
|
-
|
|
23
|
+
const base = `https://rpc.zerodev.app/api/v2/bundler/${projectId}`;
|
|
24
|
+
return provider ? `${base}?bundlerProvider=${provider}` : base;
|
|
24
25
|
};
|
|
25
|
-
const getZeroDevPaymasterRPC = (projectId, provider) => {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
26
|
+
const getZeroDevPaymasterRPC = (projectId, chainId, projectVersion, provider) => {
|
|
27
|
+
if (projectVersion === 'v2' && chainId) {
|
|
28
|
+
const base = `https://rpc.zerodev.app/api/v3/${projectId}/chain/${chainId}`;
|
|
29
|
+
return provider ? `${base}?provider=${provider}` : base;
|
|
29
30
|
}
|
|
30
|
-
|
|
31
|
+
const base = `https://rpc.zerodev.app/api/v2/paymaster/${projectId}`;
|
|
32
|
+
return provider ? `${base}?paymasterProvider=${provider}` : base;
|
|
31
33
|
};
|
|
32
34
|
const isERC20 = (value) => viem.isAddress(value);
|
|
33
35
|
const createPublicAndPaymasterClients = (bundlerRpc, paymasterRpc, chain, publicClientRpc) => {
|
|
@@ -69,9 +71,10 @@ const createKernelClientConfig = (account, bundlerRpc, chain, publicClient, paym
|
|
|
69
71
|
estimateFeesPerGas: (_a) => _tslib.__awaiter(void 0, [_a], void 0, function* ({ bundlerClient }) { return actions.getUserOperationGasPrice(bundlerClient); }),
|
|
70
72
|
},
|
|
71
73
|
});
|
|
72
|
-
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, apiKernelVersion, }) {
|
|
73
|
-
const
|
|
74
|
-
const
|
|
74
|
+
const createEcdsaKernelAccountClient = (_b) => _tslib.__awaiter(void 0, [_b], void 0, function* ({ bundlerRpc, chain, chainId, paymasterRpc, projectId, projectVersion, signer, provider, paymaster = exports.PaymasterTypeEnum.SPONSOR, entryPoint, kernelVersion, ecdsaValidator: ecdsaValidator$1, enableKernelV3Migration, publicClientRpc, apiKernelVersion, }) {
|
|
75
|
+
const resolvedChainId = chainId !== null && chainId !== void 0 ? chainId : chain === null || chain === void 0 ? void 0 : chain.id;
|
|
76
|
+
const resolvedBundlerRpc = bundlerRpc !== null && bundlerRpc !== void 0 ? bundlerRpc : getZeroDevBundlerRPC(projectId, resolvedChainId, projectVersion, provider);
|
|
77
|
+
const resolvedPaymasterRpc = paymasterRpc !== null && paymasterRpc !== void 0 ? paymasterRpc : getZeroDevPaymasterRPC(projectId, resolvedChainId, projectVersion, provider);
|
|
75
78
|
const { publicClient, zerodevPaymaster } = createPublicAndPaymasterClients(resolvedBundlerRpc, resolvedPaymasterRpc, chain, publicClientRpc);
|
|
76
79
|
const validator = yield ecdsaValidator$1(publicClient, {
|
|
77
80
|
entryPoint,
|
|
@@ -100,9 +103,10 @@ const createEcdsaKernelAccountClient = (_b) => _tslib.__awaiter(void 0, [_b], vo
|
|
|
100
103
|
const clientConfig = createKernelClientConfig(selectedAccount, resolvedBundlerRpc, chain, publicClient, paymasterHandler);
|
|
101
104
|
return clients.createKernelAccountClient(clientConfig);
|
|
102
105
|
});
|
|
103
|
-
const createEcdsaKernelAccountClientWith7702 = (_c) => _tslib.__awaiter(void 0, [_c], void 0, function* ({ bundlerRpc, chain, paymasterRpc, projectId, signer, provider, paymaster = exports.PaymasterTypeEnum.SPONSOR, entryPoint, kernelVersion, publicClientRpc, eip7702Auth, }) {
|
|
104
|
-
const
|
|
105
|
-
const
|
|
106
|
+
const createEcdsaKernelAccountClientWith7702 = (_c) => _tslib.__awaiter(void 0, [_c], void 0, function* ({ bundlerRpc, chain, chainId, paymasterRpc, projectId, projectVersion, signer, provider, paymaster = exports.PaymasterTypeEnum.SPONSOR, entryPoint, kernelVersion, publicClientRpc, eip7702Auth, }) {
|
|
107
|
+
const resolvedChainId = chainId !== null && chainId !== void 0 ? chainId : chain === null || chain === void 0 ? void 0 : chain.id;
|
|
108
|
+
const resolvedBundlerRpc = bundlerRpc !== null && bundlerRpc !== void 0 ? bundlerRpc : getZeroDevBundlerRPC(projectId, resolvedChainId, projectVersion, provider);
|
|
109
|
+
const resolvedPaymasterRpc = paymasterRpc !== null && paymasterRpc !== void 0 ? paymasterRpc : getZeroDevPaymasterRPC(projectId, resolvedChainId, projectVersion, provider);
|
|
106
110
|
const { publicClient, zerodevPaymaster } = createPublicAndPaymasterClients(resolvedBundlerRpc, resolvedPaymasterRpc, chain, publicClientRpc);
|
|
107
111
|
const account = yield accounts.createKernelAccount(publicClient, {
|
|
108
112
|
eip7702Account: signer,
|
|
@@ -11,12 +11,14 @@ export declare enum PaymasterTypeEnum {
|
|
|
11
11
|
NONE = "NONE",
|
|
12
12
|
SPONSOR = "SPONSOR"
|
|
13
13
|
}
|
|
14
|
-
export declare const getZeroDevBundlerRPC: (projectId: string, provider?: ZerodevBundlerProvider) => string;
|
|
15
|
-
export declare const getZeroDevPaymasterRPC: (projectId: string, provider?: ZerodevBundlerProvider) => string;
|
|
14
|
+
export declare const getZeroDevBundlerRPC: (projectId: string, chainId: number | undefined, projectVersion?: string, provider?: ZerodevBundlerProvider) => string;
|
|
15
|
+
export declare const getZeroDevPaymasterRPC: (projectId: string, chainId: number | undefined, projectVersion?: string, provider?: ZerodevBundlerProvider) => string;
|
|
16
16
|
type CommonClientParams<TChain extends Chain | undefined = Chain | undefined> = {
|
|
17
17
|
bundlerRpc?: string;
|
|
18
18
|
chain: TChain;
|
|
19
|
+
chainId?: number;
|
|
19
20
|
projectId: string;
|
|
21
|
+
projectVersion?: string;
|
|
20
22
|
signer: WalletClient<Transport, ViemChain, Account>;
|
|
21
23
|
paymaster: PaymasterType;
|
|
22
24
|
paymasterRpc?: string;
|
|
@@ -27,10 +29,10 @@ type CommonClientParams<TChain extends Chain | undefined = Chain | undefined> =
|
|
|
27
29
|
publicClientRpc?: string;
|
|
28
30
|
apiKernelVersion: KERNEL_VERSION_TYPE;
|
|
29
31
|
};
|
|
30
|
-
export declare const createEcdsaKernelAccountClient: <entryPoint extends EntryPointVersion, TChain extends Chain | undefined = Chain | undefined>({ bundlerRpc, chain, paymasterRpc, projectId, signer, provider, paymaster, entryPoint, kernelVersion, ecdsaValidator, enableKernelV3Migration, publicClientRpc, apiKernelVersion, }: CommonClientParams<TChain> & {
|
|
32
|
+
export declare const createEcdsaKernelAccountClient: <entryPoint extends EntryPointVersion, TChain extends Chain | undefined = Chain | undefined>({ bundlerRpc, chain, chainId, paymasterRpc, projectId, projectVersion, signer, provider, paymaster, entryPoint, kernelVersion, ecdsaValidator, enableKernelV3Migration, publicClientRpc, apiKernelVersion, }: CommonClientParams<TChain> & {
|
|
31
33
|
ecdsaValidator: any;
|
|
32
34
|
}) => Promise<KernelAccountClient<Transport, ViemChain, SmartAccount, Client, RpcSchema>>;
|
|
33
|
-
export declare const createEcdsaKernelAccountClientWith7702: <TChain extends Chain | undefined = Chain | undefined>({ bundlerRpc, chain, paymasterRpc, projectId, signer, provider, paymaster, entryPoint, kernelVersion, publicClientRpc, eip7702Auth, }: CommonClientParams<TChain> & {
|
|
35
|
+
export declare const createEcdsaKernelAccountClientWith7702: <TChain extends Chain | undefined = Chain | undefined>({ bundlerRpc, chain, chainId, paymasterRpc, projectId, projectVersion, signer, provider, paymaster, entryPoint, kernelVersion, publicClientRpc, eip7702Auth, }: CommonClientParams<TChain> & {
|
|
34
36
|
eip7702Auth?: SignAuthorizationReturnType;
|
|
35
37
|
}) => Promise<KernelAccountClient<Transport, ViemChain, SmartAccount, Client, RpcSchema>>;
|
|
36
38
|
export {};
|
|
@@ -11,19 +11,21 @@ var PaymasterTypeEnum;
|
|
|
11
11
|
PaymasterTypeEnum["NONE"] = "NONE";
|
|
12
12
|
PaymasterTypeEnum["SPONSOR"] = "SPONSOR";
|
|
13
13
|
})(PaymasterTypeEnum || (PaymasterTypeEnum = {}));
|
|
14
|
-
const getZeroDevBundlerRPC = (projectId, provider) => {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
14
|
+
const getZeroDevBundlerRPC = (projectId, chainId, projectVersion, provider) => {
|
|
15
|
+
if (projectVersion === 'v2' && chainId) {
|
|
16
|
+
const base = `https://rpc.zerodev.app/api/v3/${projectId}/chain/${chainId}`;
|
|
17
|
+
return provider ? `${base}?provider=${provider}` : base;
|
|
18
18
|
}
|
|
19
|
-
|
|
19
|
+
const base = `https://rpc.zerodev.app/api/v2/bundler/${projectId}`;
|
|
20
|
+
return provider ? `${base}?bundlerProvider=${provider}` : base;
|
|
20
21
|
};
|
|
21
|
-
const getZeroDevPaymasterRPC = (projectId, provider) => {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
22
|
+
const getZeroDevPaymasterRPC = (projectId, chainId, projectVersion, provider) => {
|
|
23
|
+
if (projectVersion === 'v2' && chainId) {
|
|
24
|
+
const base = `https://rpc.zerodev.app/api/v3/${projectId}/chain/${chainId}`;
|
|
25
|
+
return provider ? `${base}?provider=${provider}` : base;
|
|
25
26
|
}
|
|
26
|
-
|
|
27
|
+
const base = `https://rpc.zerodev.app/api/v2/paymaster/${projectId}`;
|
|
28
|
+
return provider ? `${base}?paymasterProvider=${provider}` : base;
|
|
27
29
|
};
|
|
28
30
|
const isERC20 = (value) => isAddress(value);
|
|
29
31
|
const createPublicAndPaymasterClients = (bundlerRpc, paymasterRpc, chain, publicClientRpc) => {
|
|
@@ -65,9 +67,10 @@ const createKernelClientConfig = (account, bundlerRpc, chain, publicClient, paym
|
|
|
65
67
|
estimateFeesPerGas: (_a) => __awaiter(void 0, [_a], void 0, function* ({ bundlerClient }) { return getUserOperationGasPrice(bundlerClient); }),
|
|
66
68
|
},
|
|
67
69
|
});
|
|
68
|
-
const createEcdsaKernelAccountClient = (_b) => __awaiter(void 0, [_b], void 0, function* ({ bundlerRpc, chain, paymasterRpc, projectId, signer, provider, paymaster = PaymasterTypeEnum.SPONSOR, entryPoint, kernelVersion, ecdsaValidator, enableKernelV3Migration, publicClientRpc, apiKernelVersion, }) {
|
|
69
|
-
const
|
|
70
|
-
const
|
|
70
|
+
const createEcdsaKernelAccountClient = (_b) => __awaiter(void 0, [_b], void 0, function* ({ bundlerRpc, chain, chainId, paymasterRpc, projectId, projectVersion, signer, provider, paymaster = PaymasterTypeEnum.SPONSOR, entryPoint, kernelVersion, ecdsaValidator, enableKernelV3Migration, publicClientRpc, apiKernelVersion, }) {
|
|
71
|
+
const resolvedChainId = chainId !== null && chainId !== void 0 ? chainId : chain === null || chain === void 0 ? void 0 : chain.id;
|
|
72
|
+
const resolvedBundlerRpc = bundlerRpc !== null && bundlerRpc !== void 0 ? bundlerRpc : getZeroDevBundlerRPC(projectId, resolvedChainId, projectVersion, provider);
|
|
73
|
+
const resolvedPaymasterRpc = paymasterRpc !== null && paymasterRpc !== void 0 ? paymasterRpc : getZeroDevPaymasterRPC(projectId, resolvedChainId, projectVersion, provider);
|
|
71
74
|
const { publicClient, zerodevPaymaster } = createPublicAndPaymasterClients(resolvedBundlerRpc, resolvedPaymasterRpc, chain, publicClientRpc);
|
|
72
75
|
const validator = yield ecdsaValidator(publicClient, {
|
|
73
76
|
entryPoint,
|
|
@@ -96,9 +99,10 @@ const createEcdsaKernelAccountClient = (_b) => __awaiter(void 0, [_b], void 0, f
|
|
|
96
99
|
const clientConfig = createKernelClientConfig(selectedAccount, resolvedBundlerRpc, chain, publicClient, paymasterHandler);
|
|
97
100
|
return createKernelAccountClient(clientConfig);
|
|
98
101
|
});
|
|
99
|
-
const createEcdsaKernelAccountClientWith7702 = (_c) => __awaiter(void 0, [_c], void 0, function* ({ bundlerRpc, chain, paymasterRpc, projectId, signer, provider, paymaster = PaymasterTypeEnum.SPONSOR, entryPoint, kernelVersion, publicClientRpc, eip7702Auth, }) {
|
|
100
|
-
const
|
|
101
|
-
const
|
|
102
|
+
const createEcdsaKernelAccountClientWith7702 = (_c) => __awaiter(void 0, [_c], void 0, function* ({ bundlerRpc, chain, chainId, paymasterRpc, projectId, projectVersion, signer, provider, paymaster = PaymasterTypeEnum.SPONSOR, entryPoint, kernelVersion, publicClientRpc, eip7702Auth, }) {
|
|
103
|
+
const resolvedChainId = chainId !== null && chainId !== void 0 ? chainId : chain === null || chain === void 0 ? void 0 : chain.id;
|
|
104
|
+
const resolvedBundlerRpc = bundlerRpc !== null && bundlerRpc !== void 0 ? bundlerRpc : getZeroDevBundlerRPC(projectId, resolvedChainId, projectVersion, provider);
|
|
105
|
+
const resolvedPaymasterRpc = paymasterRpc !== null && paymasterRpc !== void 0 ? paymasterRpc : getZeroDevPaymasterRPC(projectId, resolvedChainId, projectVersion, provider);
|
|
102
106
|
const { publicClient, zerodevPaymaster } = createPublicAndPaymasterClients(resolvedBundlerRpc, resolvedPaymasterRpc, chain, publicClientRpc);
|
|
103
107
|
const account = yield createKernelAccount(publicClient, {
|
|
104
108
|
eip7702Account: signer,
|