@dynamic-labs/ethereum-aa 4.0.0-alpha.6 → 4.0.0-alpha.8

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 CHANGED
@@ -1,4 +1,36 @@
1
1
 
2
+ ## [4.0.0-alpha.8](https://github.com/dynamic-labs/dynamic-auth/compare/v4.0.0-alpha.7...v4.0.0-alpha.8) (2024-10-07)
3
+
4
+
5
+ ### Features
6
+
7
+ * add support for dynamic event callbacks in rn ([#6997](https://github.com/dynamic-labs/dynamic-auth/issues/6997)) ([f9ac402](https://github.com/dynamic-labs/dynamic-auth/commit/f9ac40259d9168dfe69dafd5fd44478ba0e69505))
8
+ * add support for dynamic handlers in rn ([#7032](https://github.com/dynamic-labs/dynamic-auth/issues/7032)) ([f61f926](https://github.com/dynamic-labs/dynamic-auth/commit/f61f92666b6df8483dde2c47304fd4fb02690f7d))
9
+ * Support for multi-chain AA ([#6829](https://github.com/dynamic-labs/dynamic-auth/issues/6829)) ([b4a0c0a](https://github.com/dynamic-labs/dynamic-auth/commit/b4a0c0a4de48231a3748826600407c25abf6894d))
10
+
11
+
12
+ ### Bug Fixes
13
+
14
+ * persist isHardwareWalletEnabled on wallet connector ([#7025](https://github.com/dynamic-labs/dynamic-auth/issues/7025)) ([#7034](https://github.com/dynamic-labs/dynamic-auth/issues/7034)) ([4bfc301](https://github.com/dynamic-labs/dynamic-auth/commit/4bfc301d891f10db8c0bd31e5164c489a882c5c3))
15
+
16
+ ## [4.0.0-alpha.7](https://github.com/dynamic-labs/dynamic-auth/compare/v4.0.0-alpha.6...v4.0.0-alpha.7) (2024-10-03)
17
+
18
+
19
+ ### Features
20
+
21
+ * add account abstraction module to client ([#7002](https://github.com/dynamic-labs/dynamic-auth/issues/7002)) ([2f06975](https://github.com/dynamic-labs/dynamic-auth/commit/2f06975083dfa9d40537ef4a99b414eda1a68e01))
22
+ * add support for wallet events in rn ([#7061](https://github.com/dynamic-labs/dynamic-auth/issues/7061)) ([c7c4ce5](https://github.com/dynamic-labs/dynamic-auth/commit/c7c4ce51f27a2b84a1710c120d7006a00920c1e7))
23
+ * add zerodev extension for react native ([#7028](https://github.com/dynamic-labs/dynamic-auth/issues/7028)) ([858b8a8](https://github.com/dynamic-labs/dynamic-auth/commit/858b8a851cfa0cddc8e4559541b03992cf5ccdfc))
24
+
25
+
26
+ ### Bug Fixes
27
+
28
+ * do not modify sol tx blockhash as tx could have been signed already ([#7050](https://github.com/dynamic-labs/dynamic-auth/issues/7050)) ([770edb4](https://github.com/dynamic-labs/dynamic-auth/commit/770edb49ddc231b75fb45a9f6d563f22e5185df2))
29
+ * ensure the correct auth mode is used on social redirect ([#7047](https://github.com/dynamic-labs/dynamic-auth/issues/7047)) ([7c27172](https://github.com/dynamic-labs/dynamic-auth/commit/7c271721d5ddf19e3fd1bf56ddb1d49e0e2bca07))
30
+ * prevent react native message timeout before sdk is ready ([#7051](https://github.com/dynamic-labs/dynamic-auth/issues/7051)) ([6421237](https://github.com/dynamic-labs/dynamic-auth/commit/6421237d677d788b824d53432c1a75b9d571aa78))
31
+ * update version error text ([#7054](https://github.com/dynamic-labs/dynamic-auth/issues/7054)) ([713dacb](https://github.com/dynamic-labs/dynamic-auth/commit/713dacb79c2513323c2e6840d7418716011c2dcd))
32
+ * use project settings sdk network for send flow ([#7011](https://github.com/dynamic-labs/dynamic-auth/issues/7011)) ([983e796](https://github.com/dynamic-labs/dynamic-auth/commit/983e79632762f71ee0502c92057a32ea985ae19c))
33
+
2
34
  ## [4.0.0-alpha.6](https://github.com/dynamic-labs/dynamic-auth/compare/v4.0.0-alpha.5...v4.0.0-alpha.6) (2024-10-01)
3
35
 
4
36
 
package/package.cjs CHANGED
@@ -3,6 +3,6 @@
3
3
 
4
4
  Object.defineProperty(exports, '__esModule', { value: true });
5
5
 
6
- var version = "4.0.0-alpha.6";
6
+ var version = "4.0.0-alpha.8";
7
7
 
8
8
  exports.version = version;
package/package.js CHANGED
@@ -1,4 +1,4 @@
1
1
  'use client'
2
- var version = "4.0.0-alpha.6";
2
+ var version = "4.0.0-alpha.8";
3
3
 
4
4
  export { version };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dynamic-labs/ethereum-aa",
3
- "version": "4.0.0-alpha.6",
3
+ "version": "4.0.0-alpha.8",
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",
@@ -23,13 +23,13 @@
23
23
  "@zerodev/multi-chain-validator": "5.3.3",
24
24
  "@zerodev/sdk": "5.3.4",
25
25
  "permissionless": "^0.1.20",
26
- "@dynamic-labs/assert-package-version": "4.0.0-alpha.6",
27
- "@dynamic-labs/ethereum-core": "4.0.0-alpha.6",
28
- "@dynamic-labs/logger": "4.0.0-alpha.6",
29
- "@dynamic-labs/types": "4.0.0-alpha.6",
30
- "@dynamic-labs/utils": "4.0.0-alpha.6",
31
- "@dynamic-labs/wallet-book": "4.0.0-alpha.6",
32
- "@dynamic-labs/wallet-connector-core": "4.0.0-alpha.6"
26
+ "@dynamic-labs/assert-package-version": "4.0.0-alpha.8",
27
+ "@dynamic-labs/ethereum-core": "4.0.0-alpha.8",
28
+ "@dynamic-labs/logger": "4.0.0-alpha.8",
29
+ "@dynamic-labs/types": "4.0.0-alpha.8",
30
+ "@dynamic-labs/utils": "4.0.0-alpha.8",
31
+ "@dynamic-labs/wallet-book": "4.0.0-alpha.8",
32
+ "@dynamic-labs/wallet-connector-core": "4.0.0-alpha.8"
33
33
  },
34
34
  "peerDependencies": {
35
35
  "viem": "^2.7.6"
@@ -4,28 +4,29 @@
4
4
  Object.defineProperty(exports, '__esModule', { value: true });
5
5
 
6
6
  var _tslib = require('../_virtual/_tslib.cjs');
7
- var multiChainValidator = require('@zerodev/multi-chain-validator');
8
7
  var viem = require('viem');
9
8
  var utils$1 = require('permissionless/utils');
10
- var constants = require('@zerodev/sdk/constants');
11
- var ecdsaValidator = require('@zerodev/ecdsa-validator');
12
- var sdkApiCore = require('@dynamic-labs/sdk-api-core');
13
- var walletConnectorCore = require('@dynamic-labs/wallet-connector-core');
14
9
  var ethereumCore = require('@dynamic-labs/ethereum-core');
10
+ var walletConnectorCore = require('@dynamic-labs/wallet-connector-core');
15
11
  var utils = require('@dynamic-labs/utils');
16
- var fetchChain = require('./utils/fetchChain.cjs');
12
+ var constants = require('./constants.cjs');
17
13
  var logger = require('./utils/logger.cjs');
18
14
  var createEcsdaKernelAccountClient = require('./utils/createEcsdaKernelAccountClient.cjs');
15
+ var getEcdsaValidator = require('./utils/getEcdsaValidator.cjs');
16
+ var getEntryPoint = require('./utils/getEntryPoint.cjs');
17
+ var getKernelVersion = require('./utils/getKernelVersion.cjs');
19
18
 
20
19
  class ZeroDevConnector extends walletConnectorCore.WalletConnectorBase {
21
20
  constructor(opts) {
22
21
  var _a, _b, _c, _d;
23
22
  super(opts);
23
+ this.providerMap = {};
24
24
  this.ChainWallet = ethereumCore.EthereumWallet;
25
25
  this.connectedChain = 'EVM';
26
26
  this.supportedChains = ['ETH', 'EVM'];
27
27
  this.isGasSponsorshipDisabled = false;
28
28
  this.isEmbeddedWallet = true;
29
+ this.providersFromApi = [];
29
30
  this.name = 'ZeroDev';
30
31
  this.overrideKey = 'zerodev';
31
32
  this.walletFallback = {
@@ -35,59 +36,64 @@ class ZeroDevConnector extends walletConnectorCore.WalletConnectorBase {
35
36
  },
36
37
  name: 'ZeroDev',
37
38
  };
38
- const zeroDevProjectId = (_a = opts.apiProviders.zerodev) === null || _a === void 0 ? void 0 : _a.clientId;
39
- if (!zeroDevProjectId) {
40
- throw new Error('Missing ZeroDev project ID provided. Add your ZeroDev project id to your project configuration via the Dynamic Labs dashboard.');
41
- }
42
- this.projectId = zeroDevProjectId;
43
39
  this._walletUiUtils = opts.walletUiUtils;
44
40
  this.evmNetworks = utils.parseEvmNetworks(opts.evmNetworks);
45
- this.entryPoint = this.getEntryPoint((_b = opts.apiProviders.zerodev) === null || _b === void 0 ? void 0 : _b.entryPointVersion);
46
- this.kernelVersion = this.getKernelVersion((_c = opts.apiProviders.zerodev) === null || _c === void 0 ? void 0 : _c.kernelVersion);
41
+ this.entryPoint = getEntryPoint.getEntryPoint((_a = opts.apiProviders.zerodev) === null || _a === void 0 ? void 0 : _a.entryPointVersion);
42
+ this.kernelVersion = getKernelVersion.getKernelVersion((_b = opts.apiProviders.zerodev) === null || _b === void 0 ? void 0 : _b.kernelVersion, this.entryPoint);
43
+ // this is the list of providers from the api that are used for multi-chain account abstraction
44
+ this.providersFromApi =
45
+ ((_c = opts.apiProviders.zerodev) === null || _c === void 0 ? void 0 : _c.multichainAccountAbstractionProviders) || [];
46
+ const [defaultProvider] = this.providersFromApi;
47
+ this.clientId = defaultProvider === null || defaultProvider === void 0 ? void 0 : defaultProvider.clientId;
48
+ if (!this.clientId) {
49
+ throw new Error('Missing ZeroDev project ID provided. Add your ZeroDev project id to your project configuration via the Dynamic Labs dashboard.');
50
+ }
51
+ this.defaultChainId = defaultProvider === null || defaultProvider === void 0 ? void 0 : defaultProvider.chain;
47
52
  this.ecdsaProviderType = (_d = opts.apiProviders.zerodev) === null || _d === void 0 ? void 0 : _d.ecdsaProviderType;
48
53
  }
49
- getEntryPoint(entryPoint) {
50
- if (entryPoint === undefined ||
51
- entryPoint === sdkApiCore.ProviderEntryPointVersionEnum.V7) {
52
- return utils$1.ENTRYPOINT_ADDRESS_V07;
53
- }
54
- else if (entryPoint === sdkApiCore.ProviderEntryPointVersionEnum.V6) {
55
- return utils$1.ENTRYPOINT_ADDRESS_V06;
54
+ get currentNetworkProvider() {
55
+ // check if the last used chain id is in the provider map
56
+ if (this.providerMap[this.lastUsedChainId]) {
57
+ return this.providerMap[this.lastUsedChainId];
56
58
  }
57
- else {
58
- logger.logger.error('Invalid entry point version', entryPoint);
59
- return utils$1.ENTRYPOINT_ADDRESS_V07;
59
+ // if not, check if the default chain id is in the provider map
60
+ if (this.defaultChainId) {
61
+ return this.providerMap[this.defaultChainId];
60
62
  }
63
+ // if no chain id is found, return undefined
64
+ return undefined;
61
65
  }
62
- getKernelVersion(kernelVersion) {
63
- if (kernelVersion === sdkApiCore.ProviderKernelVersionEnum.V31 ||
64
- (kernelVersion === undefined &&
65
- this.entryPoint === utils$1.ENTRYPOINT_ADDRESS_V07)) {
66
- return constants.KERNEL_V3_1;
67
- }
68
- else if (kernelVersion === sdkApiCore.ProviderKernelVersionEnum.V30) {
69
- return constants.KERNEL_V3_0;
70
- }
71
- else if (kernelVersion === sdkApiCore.ProviderKernelVersionEnum.V24 ||
72
- this.entryPoint === utils$1.ENTRYPOINT_ADDRESS_V06 // v0.6 only supports v2.4
73
- ) {
74
- return constants.KERNEL_V2_4;
75
- }
76
- else {
77
- logger.logger.error('Invalid kernel version', kernelVersion);
78
- return constants.KERNEL_V3_1;
79
- }
66
+ get lastUsedChainId() {
67
+ var _a;
68
+ const storedChainId = utils.StorageService.getItem(constants.ZERO_DEV_LAST_USED_CHAIN_ID_KEY);
69
+ // returning string of unknown if no chain id is found to result in undefined provider lookup
70
+ return (_a = storedChainId !== null && storedChainId !== void 0 ? storedChainId : this.defaultChainId) !== null && _a !== void 0 ? _a : 'unknown';
80
71
  }
81
- getEcdsaValidator(ecdsaProviderType) {
82
- if (ecdsaProviderType === 'zerodev_signer_to_ecdsa') {
83
- return ecdsaValidator.signerToEcdsaValidator;
84
- }
85
- else if (ecdsaProviderType === 'zerodev_multi_chain') {
86
- return multiChainValidator.toMultiChainECDSAValidator;
87
- }
88
- else {
89
- return ecdsaValidator.signerToEcdsaValidator;
90
- }
72
+ get kernelClient() {
73
+ var _a;
74
+ return (_a = this.currentNetworkProvider) === null || _a === void 0 ? void 0 : _a.kernelClient;
75
+ }
76
+ get kernelClientWithSponsorship() {
77
+ var _a;
78
+ return (_a = this.currentNetworkProvider) === null || _a === void 0 ? void 0 : _a.kernelClientWithSponsorship;
79
+ }
80
+ supportsNetworkSwitching() {
81
+ return (Object.keys(this.providerMap).length > 1 && this.evmNetworks.length > 1);
82
+ }
83
+ switchNetwork(_a) {
84
+ return _tslib.__awaiter(this, arguments, void 0, function* ({ networkChainId, }) {
85
+ if (!this.supportsNetworkSwitching())
86
+ return;
87
+ if (!networkChainId)
88
+ return;
89
+ const chainId = networkChainId.toString();
90
+ if (!this.providerMap[chainId]) {
91
+ throw new Error(`No provider found for chainId: ${chainId}`);
92
+ }
93
+ utils.StorageService.setItem(constants.ZERO_DEV_LAST_USED_CHAIN_ID_KEY, chainId);
94
+ const { handleChainChange } = walletConnectorCore.eventListenerHandlers(this);
95
+ handleChainChange(chainId);
96
+ });
91
97
  }
92
98
  /**
93
99
  * @deprecated You should get the EOA connector by passing the SCW to getEOAConnector,
@@ -104,7 +110,7 @@ class ZeroDevConnector extends walletConnectorCore.WalletConnectorBase {
104
110
  }
105
111
  endSession() {
106
112
  return _tslib.__awaiter(this, void 0, void 0, function* () {
107
- localStorage.removeItem(fetchChain.cachedChainIdKey);
113
+ utils.StorageService.removeItem(constants.ZERO_DEV_LAST_USED_CHAIN_ID_KEY);
108
114
  });
109
115
  }
110
116
  setEoaConnector(connector) {
@@ -124,15 +130,63 @@ class ZeroDevConnector extends walletConnectorCore.WalletConnectorBase {
124
130
  logger.logger.error('No signer account found');
125
131
  return;
126
132
  }
133
+ yield this.generateProviderMap(signer);
134
+ this.evmNetworks = this.evmNetworks.filter((network) => Boolean(this.providerMap[network.chainId]));
135
+ this.kernelClientDeferredPromise.resolve();
136
+ });
137
+ }
138
+ warnIfProjectChainNotEnabled(chainId) {
139
+ return _tslib.__awaiter(this, void 0, void 0, function* () {
140
+ var _a;
141
+ let chainIdToCheck = chainId;
142
+ if (!chainIdToCheck) {
143
+ const client = yield this.getPublicClient();
144
+ chainIdToCheck = (_a = client === null || client === void 0 ? void 0 : client.chain) === null || _a === void 0 ? void 0 : _a.id;
145
+ }
146
+ const isProjectChainEnabled = this.evmNetworks.some((network) => network.chainId === chainIdToCheck);
147
+ if (!isProjectChainEnabled) {
148
+ logger.logger.error(`Please make sure to enable (${chainIdToCheck}) in the Dynamic dashboard (https://app.dynamic.xyz/dashboard/configurations#evm).`);
149
+ }
150
+ });
151
+ }
152
+ generateProviderMap(signer) {
153
+ return _tslib.__awaiter(this, void 0, void 0, function* () {
154
+ for (const provider of this.providersFromApi) {
155
+ if (!this.providerMap[provider.chain]) {
156
+ this.providerMap[provider.chain] = {
157
+ kernelClient: yield this.getKernelClientWithoutSponsorshipValidation({
158
+ chainId: provider.chain,
159
+ projectId: provider.clientId,
160
+ signer,
161
+ }),
162
+ kernelClientWithSponsorship: yield this.getKernelClientWithSponsorshipValidation({
163
+ chainId: provider.chain,
164
+ projectId: provider.clientId,
165
+ signer,
166
+ }),
167
+ };
168
+ }
169
+ yield this.warnIfProjectChainNotEnabled(utils.parseChainId(provider.chain));
170
+ }
171
+ });
172
+ }
173
+ getKernelClientWithoutSponsorshipValidation(_a) {
174
+ return _tslib.__awaiter(this, arguments, void 0, function* ({ projectId, signer, chainId, }) {
175
+ if (chainId && this.providerMap[chainId]) {
176
+ return this.providerMap[chainId].kernelClient;
177
+ }
178
+ const { eoaConnector } = this;
179
+ if (!eoaConnector)
180
+ throw new utils.DynamicError('No EOA connector');
127
181
  const kernelClient = yield createEcsdaKernelAccountClient.createEcdsaKernelAccountClient({
128
182
  bundlerRpc: ZeroDevConnector.bundlerRpc,
129
- chain: yield fetchChain.fetchChain(this.projectId),
130
- ecdsaValidator: this.getEcdsaValidator(this.ecdsaProviderType),
183
+ chain: ethereumCore.chainsMap[chainId],
184
+ ecdsaValidator: getEcdsaValidator.getEcdsaValidator(this.ecdsaProviderType),
131
185
  entryPointAddress: this.entryPoint,
132
186
  kernelVersion: this.kernelVersion,
133
187
  paymaster: 'NONE',
134
188
  paymasterRpc: ZeroDevConnector.paymasterRpc,
135
- projectId: this.projectId,
189
+ projectId,
136
190
  provider: ZeroDevConnector.bundlerProvider,
137
191
  signer: utils$1.walletClientToSmartAccountSigner(signer),
138
192
  });
@@ -140,51 +194,34 @@ class ZeroDevConnector extends walletConnectorCore.WalletConnectorBase {
140
194
  this._walletUiUtils.disabledConfirmationOnce();
141
195
  return original(...args);
142
196
  });
143
- this.kernelClient = kernelClient;
144
- // set the provider with sponsorship enabled
145
- yield this.getKernelClientWithSponsorshipValidation();
146
- yield this.checkIsProjectChainEnabled();
147
- this.kernelClientDeferredPromise.resolve();
197
+ return kernelClient;
148
198
  });
149
199
  }
150
- checkIsProjectChainEnabled() {
151
- return _tslib.__awaiter(this, void 0, void 0, function* () {
152
- var _a, _b;
153
- const client = yield this.getPublicClient();
154
- const chainName = (_a = client === null || client === void 0 ? void 0 : client.chain) === null || _a === void 0 ? void 0 : _a.name;
155
- const chainId = (_b = client === null || client === void 0 ? void 0 : client.chain) === null || _b === void 0 ? void 0 : _b.id;
156
- const isProjectChainEnabled = this.evmNetworks.some((network) => network.chainId === chainId);
157
- if (!isProjectChainEnabled) {
158
- logger.logger.error(`Please make sure to enable ${chainName} (${chainId}) in the Dynamic dashboard (https://app.dynamic.xyz/dashboard/configurations#evm).`);
159
- }
160
- });
161
- }
162
- getKernelClientWithSponsorshipValidation() {
163
- return _tslib.__awaiter(this, void 0, void 0, function* () {
164
- if (this.kernelClientWithSponsorship) {
165
- return this.kernelClientWithSponsorship;
200
+ getKernelClientWithSponsorshipValidation(_a) {
201
+ return _tslib.__awaiter(this, arguments, void 0, function* ({ projectId, signer, chainId, }) {
202
+ if (chainId && this.providerMap[chainId]) {
203
+ return this.providerMap[chainId].kernelClientWithSponsorship;
166
204
  }
167
205
  const { eoaConnector } = this;
168
206
  if (!eoaConnector)
169
207
  throw new utils.DynamicError('No EOA connector');
170
- const signer = yield eoaConnector.getSigner();
171
- this.kernelClientWithSponsorship = yield createEcsdaKernelAccountClient.createEcdsaKernelAccountClient({
208
+ const kernelClientWithSponsorship = yield createEcsdaKernelAccountClient.createEcdsaKernelAccountClient({
172
209
  bundlerRpc: ZeroDevConnector.bundlerRpc,
173
- chain: yield fetchChain.fetchChain(this.projectId),
174
- ecdsaValidator: this.getEcdsaValidator(this.ecdsaProviderType),
210
+ chain: ethereumCore.chainsMap[chainId],
211
+ ecdsaValidator: getEcdsaValidator.getEcdsaValidator(this.ecdsaProviderType),
175
212
  entryPointAddress: this.entryPoint,
176
213
  kernelVersion: this.kernelVersion,
177
214
  paymaster: 'SPONSOR',
178
215
  paymasterRpc: ZeroDevConnector.paymasterRpc,
179
- projectId: this.projectId,
216
+ projectId,
180
217
  provider: ZeroDevConnector.bundlerProvider,
181
218
  signer: utils$1.walletClientToSmartAccountSigner(signer),
182
219
  });
183
- utils.wrapMethodWithCallback(this.kernelClientWithSponsorship, 'sendUserOperation', (original, ...args) => {
220
+ utils.wrapMethodWithCallback(kernelClientWithSponsorship, 'sendUserOperation', (original, ...args) => {
184
221
  this._walletUiUtils.disabledConfirmationOnce();
185
222
  return original(...args);
186
223
  });
187
- return this.kernelClientWithSponsorship;
224
+ return kernelClientWithSponsorship;
188
225
  });
189
226
  }
190
227
  getAddress() {
@@ -225,7 +262,10 @@ class ZeroDevConnector extends walletConnectorCore.WalletConnectorBase {
225
262
  this._walletUiUtils.disabledConfirmationOnce();
226
263
  const effectiveProvider = this.isGasSponsorshipDisabled
227
264
  ? provider
228
- : yield this.getKernelClientWithSponsorshipValidation();
265
+ : this.kernelClientWithSponsorship;
266
+ if (!effectiveProvider) {
267
+ throw new utils.DynamicError('No provider');
268
+ }
229
269
  const response = yield effectiveProvider.sendTransaction(ethereumCore.unFormatTransaction(transaction));
230
270
  return response;
231
271
  }
@@ -263,7 +303,7 @@ class ZeroDevConnector extends walletConnectorCore.WalletConnectorBase {
263
303
  var _a;
264
304
  const provider = this.kernelClient;
265
305
  if (!provider)
266
- throw new utils.DynamicError('No provider');
306
+ return undefined;
267
307
  const transport = this.getTransport(provider);
268
308
  const address = (_a = provider.account) === null || _a === void 0 ? void 0 : _a.address;
269
309
  const walletClient = viem.createWalletClient({
@@ -278,7 +318,7 @@ class ZeroDevConnector extends walletConnectorCore.WalletConnectorBase {
278
318
  var _a;
279
319
  const provider = (_a = this.kernelClient) === null || _a === void 0 ? void 0 : _a.extend(viem.publicActions);
280
320
  if (!provider)
281
- throw new utils.DynamicError('No provider');
321
+ return undefined;
282
322
  return provider;
283
323
  });
284
324
  }
@@ -290,7 +330,10 @@ class ZeroDevConnector extends walletConnectorCore.WalletConnectorBase {
290
330
  canSponsorTransactionGas(transaction) {
291
331
  return _tslib.__awaiter(this, void 0, void 0, function* () {
292
332
  try {
293
- const kernelClientWithSponsorship = yield this.getKernelClientWithSponsorshipValidation();
333
+ const { kernelClientWithSponsorship } = this;
334
+ if (!kernelClientWithSponsorship) {
335
+ throw new utils.DynamicError('No kernel client with sponsorship found');
336
+ }
294
337
  const userOperation = {
295
338
  callData: yield kernelClientWithSponsorship.account.encodeCallData({
296
339
  data: transaction.data ? transaction.data : '0x',