@dynamic-labs/ethereum-aa 0.0.0-exp20240808.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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2022 Dynamic Labs, Inc.
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
File without changes
@@ -0,0 +1,36 @@
1
+ 'use client'
2
+ 'use strict';
3
+
4
+ Object.defineProperty(exports, '__esModule', { value: true });
5
+
6
+ /******************************************************************************
7
+ Copyright (c) Microsoft Corporation.
8
+
9
+ Permission to use, copy, modify, and/or distribute this software for any
10
+ purpose with or without fee is hereby granted.
11
+
12
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
13
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
14
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
15
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
16
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
17
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
18
+ PERFORMANCE OF THIS SOFTWARE.
19
+ ***************************************************************************** */
20
+
21
+ function __awaiter(thisArg, _arguments, P, generator) {
22
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
23
+ return new (P || (P = Promise))(function (resolve, reject) {
24
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
25
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
26
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
27
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
28
+ });
29
+ }
30
+
31
+ typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
32
+ var e = new Error(message);
33
+ return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
34
+ };
35
+
36
+ exports.__awaiter = __awaiter;
@@ -0,0 +1,32 @@
1
+ 'use client'
2
+ /******************************************************************************
3
+ Copyright (c) Microsoft Corporation.
4
+
5
+ Permission to use, copy, modify, and/or distribute this software for any
6
+ purpose with or without fee is hereby granted.
7
+
8
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
9
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
10
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
11
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
12
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
13
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
14
+ PERFORMANCE OF THIS SOFTWARE.
15
+ ***************************************************************************** */
16
+
17
+ function __awaiter(thisArg, _arguments, P, generator) {
18
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
19
+ return new (P || (P = Promise))(function (resolve, reject) {
20
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
21
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
22
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
23
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
24
+ });
25
+ }
26
+
27
+ typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
28
+ var e = new Error(message);
29
+ return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
30
+ };
31
+
32
+ export { __awaiter };
package/package.json ADDED
@@ -0,0 +1,45 @@
1
+ {
2
+ "name": "@dynamic-labs/ethereum-aa",
3
+ "version": "0.0.0-exp20240808.0",
4
+ "repository": {
5
+ "type": "git",
6
+ "url": "git+https://github.com/dynamic-labs/dynamic-auth.git",
7
+ "directory": "packages/ethereum-aa"
8
+ },
9
+ "description": "A React SDK for implementing wallet web3 authentication and authorization to your website.",
10
+ "bugs": {
11
+ "url": "https://github.com/dynamic-labs/DynamicAuth/issues"
12
+ },
13
+ "homepage": "https://github.com/dynamic-labs/DynamicAuth#readme",
14
+ "author": "Dynamic Labs, Inc.",
15
+ "license": "MIT",
16
+ "main": "./src/index.cjs",
17
+ "module": "./src/index.js",
18
+ "types": "./src/index.d.ts",
19
+ "type": "module",
20
+ "exports": {
21
+ ".": {
22
+ "types": "./src/index.d.ts",
23
+ "import": "./src/index.js",
24
+ "require": "./src/index.cjs"
25
+ },
26
+ "./package.json": "./package.json"
27
+ },
28
+ "dependencies": {
29
+ "@dynamic-labs/sdk-api-core": "0.0.509",
30
+ "@zerodev/ecdsa-validator": "5.3.1",
31
+ "@zerodev/multi-chain-validator": "5.3.3",
32
+ "@zerodev/sdk": "5.3.4",
33
+ "permissionless": "^0.1.20",
34
+ "@dynamic-labs/ethereum": "0.0.0-exp20240808.0",
35
+ "@dynamic-labs/logger": "0.0.0-exp20240808.0",
36
+ "@dynamic-labs/types": "0.0.0-exp20240808.0",
37
+ "@dynamic-labs/utils": "0.0.0-exp20240808.0",
38
+ "@dynamic-labs/viem-utils": "0.0.0-exp20240808.0",
39
+ "@dynamic-labs/wallet-book": "0.0.0-exp20240808.0",
40
+ "@dynamic-labs/wallet-connector-core": "0.0.0-exp20240808.0"
41
+ },
42
+ "peerDependencies": {
43
+ "viem": "^2.7.6"
44
+ }
45
+ }
@@ -0,0 +1,353 @@
1
+ 'use client'
2
+ 'use strict';
3
+
4
+ Object.defineProperty(exports, '__esModule', { value: true });
5
+
6
+ var _tslib = require('../_virtual/_tslib.cjs');
7
+ var multiChainValidator = require('@zerodev/multi-chain-validator');
8
+ var viem = require('viem');
9
+ 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
+ var viemUtils = require('@dynamic-labs/viem-utils');
15
+ var utils = require('@dynamic-labs/utils');
16
+ var ethereum = require('@dynamic-labs/ethereum');
17
+ var fetchChain = require('./utils/fetchChain.cjs');
18
+ var logger = require('./utils/logger.cjs');
19
+ var createEcsdaKernelAccountClient = require('./utils/createEcsdaKernelAccountClient.cjs');
20
+
21
+ class ZeroDevConnector extends walletConnectorCore.WalletConnectorBase {
22
+ constructor(opts) {
23
+ var _a, _b, _c, _d;
24
+ super(opts);
25
+ this.ChainWallet = ethereum.EthereumWallet;
26
+ this.connectedChain = 'EVM';
27
+ this.supportedChains = ['ETH', 'EVM'];
28
+ this.isGasSponsorshipDisabled = false;
29
+ this.isEmbeddedWallet = true;
30
+ this.name = 'ZeroDev';
31
+ this.overrideKey = 'zerodev';
32
+ this.walletFallback = {
33
+ brand: {
34
+ alt: 'Smart Wallet',
35
+ spriteId: 'smartwallet',
36
+ },
37
+ name: 'ZeroDev',
38
+ };
39
+ const zeroDevProjectId = (_a = opts.apiProviders.zerodev) === null || _a === void 0 ? void 0 : _a.clientId;
40
+ if (!zeroDevProjectId) {
41
+ throw new Error('Missing ZeroDev project ID provided. Add your ZeroDev project id to your project configuration via the Dynamic Labs dashboard.');
42
+ }
43
+ this.projectId = zeroDevProjectId;
44
+ this._walletUiUtils = opts.walletUiUtils;
45
+ this.evmNetworks = utils.parseEvmNetworks(opts.evmNetworks);
46
+ this.entryPoint = this.getEntryPoint((_b = opts.apiProviders.zerodev) === null || _b === void 0 ? void 0 : _b.entryPointVersion);
47
+ this.kernelVersion = this.getKernelVersion((_c = opts.apiProviders.zerodev) === null || _c === void 0 ? void 0 : _c.kernelVersion);
48
+ this.ecdsaProviderType = (_d = opts.apiProviders.zerodev) === null || _d === void 0 ? void 0 : _d.ecdsaProviderType;
49
+ }
50
+ getEntryPoint(entryPoint) {
51
+ if (entryPoint === undefined ||
52
+ entryPoint === sdkApiCore.ProviderEntryPointVersionEnum.V7) {
53
+ return utils$1.ENTRYPOINT_ADDRESS_V07;
54
+ }
55
+ else if (entryPoint === sdkApiCore.ProviderEntryPointVersionEnum.V6) {
56
+ return utils$1.ENTRYPOINT_ADDRESS_V06;
57
+ }
58
+ else {
59
+ logger.logger.error('Invalid entry point version', entryPoint);
60
+ return utils$1.ENTRYPOINT_ADDRESS_V07;
61
+ }
62
+ }
63
+ getKernelVersion(kernelVersion) {
64
+ if (kernelVersion === sdkApiCore.ProviderKernelVersionEnum.V31 ||
65
+ (kernelVersion === undefined &&
66
+ this.entryPoint === utils$1.ENTRYPOINT_ADDRESS_V07)) {
67
+ return constants.KERNEL_V3_1;
68
+ }
69
+ else if (kernelVersion === sdkApiCore.ProviderKernelVersionEnum.V30) {
70
+ return constants.KERNEL_V3_0;
71
+ }
72
+ else if (kernelVersion === sdkApiCore.ProviderKernelVersionEnum.V24 ||
73
+ this.entryPoint === utils$1.ENTRYPOINT_ADDRESS_V06 // v0.6 only supports v2.4
74
+ ) {
75
+ return constants.KERNEL_V2_4;
76
+ }
77
+ else {
78
+ logger.logger.error('Invalid kernel version', kernelVersion);
79
+ return constants.KERNEL_V3_1;
80
+ }
81
+ }
82
+ getEcdsaValidator(ecdsaProviderType) {
83
+ if (ecdsaProviderType === 'zerodev_signer_to_ecdsa') {
84
+ return ecdsaValidator.signerToEcdsaValidator;
85
+ }
86
+ else if (ecdsaProviderType === 'zerodev_multi_chain') {
87
+ return multiChainValidator.toMultiChainECDSAValidator;
88
+ }
89
+ else {
90
+ return ecdsaValidator.signerToEcdsaValidator;
91
+ }
92
+ }
93
+ getEOAConnector() {
94
+ return this.eoaConnector;
95
+ }
96
+ getAccountAbstractionProvider({ withSponsorship, } = {}) {
97
+ if (withSponsorship && this.kernelClientWithSponsorship) {
98
+ return this.kernelClientWithSponsorship;
99
+ }
100
+ return this.kernelClient;
101
+ }
102
+ endSession() {
103
+ return _tslib.__awaiter(this, void 0, void 0, function* () {
104
+ localStorage.removeItem(fetchChain.cachedChainIdKey);
105
+ });
106
+ }
107
+ setEoaConnector(connector) {
108
+ return _tslib.__awaiter(this, void 0, void 0, function* () {
109
+ if (!connector) {
110
+ logger.logger.error('No EOA connector provided');
111
+ return;
112
+ }
113
+ this.kernelClientDeferredPromise = new utils.DeferredPromise();
114
+ this.eoaConnector = connector;
115
+ if (ethereum.isEthWalletConnector(this.eoaConnector) &&
116
+ !this.eoaConnector.getActiveAccount()) {
117
+ yield this.eoaConnector.getConnectedAccounts();
118
+ }
119
+ const signer = yield this.eoaConnector.getSigner();
120
+ if (!(signer === null || signer === void 0 ? void 0 : signer.account)) {
121
+ logger.logger.error('No signer account found');
122
+ return;
123
+ }
124
+ const kernelClient = yield createEcsdaKernelAccountClient.createEcdsaKernelAccountClient({
125
+ bundlerRpc: ZeroDevConnector.bundlerRpc,
126
+ chain: yield fetchChain.fetchChain(this.projectId),
127
+ ecdsaValidator: this.getEcdsaValidator(this.ecdsaProviderType),
128
+ entryPointAddress: this.entryPoint,
129
+ kernelVersion: this.kernelVersion,
130
+ paymaster: 'NONE',
131
+ paymasterRpc: ZeroDevConnector.paymasterRpc,
132
+ projectId: this.projectId,
133
+ provider: ZeroDevConnector.bundlerProvider,
134
+ signer: utils$1.walletClientToSmartAccountSigner(signer),
135
+ });
136
+ utils.wrapMethodWithCallback(kernelClient, 'sendUserOperation', (original, ...args) => {
137
+ this._walletUiUtils.disabledConfirmationOnce();
138
+ return original(...args);
139
+ });
140
+ this.kernelClient = kernelClient;
141
+ // set the provider with sponsorship enabled
142
+ yield this.getKernelClientWithSponsorshipValidation();
143
+ yield this.checkIsProjectChainEnabled();
144
+ this.kernelClientDeferredPromise.resolve();
145
+ });
146
+ }
147
+ checkIsProjectChainEnabled() {
148
+ return _tslib.__awaiter(this, void 0, void 0, function* () {
149
+ var _a, _b;
150
+ const client = yield this.getPublicClient();
151
+ const chainName = (_a = client === null || client === void 0 ? void 0 : client.chain) === null || _a === void 0 ? void 0 : _a.name;
152
+ const chainId = (_b = client === null || client === void 0 ? void 0 : client.chain) === null || _b === void 0 ? void 0 : _b.id;
153
+ const isProjectChainEnabled = this.evmNetworks.some((network) => network.chainId === chainId);
154
+ if (!isProjectChainEnabled) {
155
+ logger.logger.error(`Please make sure to enable ${chainName} (${chainId}) in the Dynamic dashboard (https://app.dynamic.xyz/dashboard/configurations#evm).`);
156
+ }
157
+ });
158
+ }
159
+ getKernelClientWithSponsorshipValidation() {
160
+ return _tslib.__awaiter(this, void 0, void 0, function* () {
161
+ if (this.kernelClientWithSponsorship) {
162
+ return this.kernelClientWithSponsorship;
163
+ }
164
+ const { eoaConnector } = this;
165
+ if (!eoaConnector)
166
+ throw new utils.DynamicError('No EOA connector');
167
+ const signer = yield eoaConnector.getSigner();
168
+ this.kernelClientWithSponsorship = yield createEcsdaKernelAccountClient.createEcdsaKernelAccountClient({
169
+ bundlerRpc: ZeroDevConnector.bundlerRpc,
170
+ chain: yield fetchChain.fetchChain(this.projectId),
171
+ ecdsaValidator: this.getEcdsaValidator(this.ecdsaProviderType),
172
+ entryPointAddress: this.entryPoint,
173
+ kernelVersion: this.kernelVersion,
174
+ paymaster: 'SPONSOR',
175
+ paymasterRpc: ZeroDevConnector.paymasterRpc,
176
+ projectId: this.projectId,
177
+ provider: ZeroDevConnector.bundlerProvider,
178
+ signer: utils$1.walletClientToSmartAccountSigner(signer),
179
+ });
180
+ utils.wrapMethodWithCallback(this.kernelClientWithSponsorship, 'sendUserOperation', (original, ...args) => {
181
+ this._walletUiUtils.disabledConfirmationOnce();
182
+ return original(...args);
183
+ });
184
+ return this.kernelClientWithSponsorship;
185
+ });
186
+ }
187
+ getAddress() {
188
+ return _tslib.__awaiter(this, void 0, void 0, function* () {
189
+ var _a, _b, _c;
190
+ yield ((_a = this.kernelClientDeferredPromise) === null || _a === void 0 ? void 0 : _a.promise);
191
+ return (_c = (_b = this.kernelClient) === null || _b === void 0 ? void 0 : _b.account) === null || _c === void 0 ? void 0 : _c.address;
192
+ });
193
+ }
194
+ getConnectedAccounts() {
195
+ return _tslib.__awaiter(this, void 0, void 0, function* () {
196
+ var _a, _b, _c;
197
+ yield ((_a = this.kernelClientDeferredPromise) === null || _a === void 0 ? void 0 : _a.promise);
198
+ return ((_c = (_b = this.kernelClient) === null || _b === void 0 ? void 0 : _b.account) === null || _c === void 0 ? void 0 : _c.address)
199
+ ? [yield this.kernelClient.account.address]
200
+ : [];
201
+ });
202
+ }
203
+ getNetwork() {
204
+ return _tslib.__awaiter(this, void 0, void 0, function* () {
205
+ var _a, _b, _c;
206
+ yield ((_a = this.kernelClientDeferredPromise) === null || _a === void 0 ? void 0 : _a.promise);
207
+ return (_c = (_b = this.kernelClient) === null || _b === void 0 ? void 0 : _b.chain) === null || _c === void 0 ? void 0 : _c.id;
208
+ });
209
+ }
210
+ getTransport(provider) {
211
+ const transport = viemUtils.confirmationTransport({
212
+ getAccounts: () => _tslib.__awaiter(this, void 0, void 0, function* () { return [provider.account.address]; }),
213
+ onPersonalSign: (_a) => _tslib.__awaiter(this, [_a], void 0, function* ({ message }) {
214
+ this._walletUiUtils.disabledConfirmationOnce();
215
+ return provider.signMessage({
216
+ account: provider.account,
217
+ message,
218
+ });
219
+ }),
220
+ onSendTransaction: (_b) => _tslib.__awaiter(this, [_b], void 0, function* ({ transaction }) {
221
+ try {
222
+ this._walletUiUtils.disabledConfirmationOnce();
223
+ const effectiveProvider = this.isGasSponsorshipDisabled
224
+ ? provider
225
+ : yield this.getKernelClientWithSponsorshipValidation();
226
+ const response = yield effectiveProvider.sendTransaction(viemUtils.unFormatTransaction(transaction));
227
+ return response;
228
+ }
229
+ catch (err) {
230
+ logger.logger.debug(err);
231
+ if (utils.TransactionGasCannotBeSponsoredError.isErrorMessage(err)) {
232
+ throw new utils.TransactionGasCannotBeSponsoredError();
233
+ }
234
+ if (utils.InsufficientFundsError.isErrorMessage(err)) {
235
+ throw new utils.InsufficientFundsError();
236
+ }
237
+ throw err;
238
+ }
239
+ }),
240
+ onSignTypedData: (_c) => _tslib.__awaiter(this, [_c], void 0, function* ({ message }) {
241
+ this._walletUiUtils.disabledConfirmationOnce();
242
+ const signTypedData = JSON.parse(message);
243
+ return provider.signTypedData({
244
+ account: provider.account,
245
+ domain: signTypedData.domain,
246
+ message: signTypedData.message,
247
+ primaryType: signTypedData.primaryType,
248
+ types: signTypedData.types,
249
+ });
250
+ }),
251
+ provider: provider.extend(viem.publicActions),
252
+ transport: viem.custom(provider),
253
+ walletConnector: this,
254
+ walletUiUtils: this._walletUiUtils,
255
+ });
256
+ return transport;
257
+ }
258
+ getWalletClient(chainId) {
259
+ var _a;
260
+ const provider = this.kernelClient;
261
+ if (!provider)
262
+ throw new utils.DynamicError('No provider');
263
+ const transport = this.getTransport(provider);
264
+ const address = (_a = provider.account) === null || _a === void 0 ? void 0 : _a.address;
265
+ const walletClient = viem.createWalletClient({
266
+ account: address,
267
+ chain: chainId ? viemUtils.chainsMap[chainId] : provider.chain,
268
+ transport,
269
+ });
270
+ return walletClient;
271
+ }
272
+ getPublicClient() {
273
+ return _tslib.__awaiter(this, void 0, void 0, function* () {
274
+ var _a;
275
+ const provider = (_a = this.kernelClient) === null || _a === void 0 ? void 0 : _a.extend(viem.publicActions);
276
+ if (!provider)
277
+ throw new utils.DynamicError('No provider');
278
+ return provider;
279
+ });
280
+ }
281
+ getSigner() {
282
+ return _tslib.__awaiter(this, void 0, void 0, function* () {
283
+ return this.getWalletClient();
284
+ });
285
+ }
286
+ canSponsorTransactionGas(transaction) {
287
+ return _tslib.__awaiter(this, void 0, void 0, function* () {
288
+ try {
289
+ const kernelClientWithSponsorship = yield this.getKernelClientWithSponsorshipValidation();
290
+ const userOperation = {
291
+ callData: yield kernelClientWithSponsorship.account.encodeCallData({
292
+ data: transaction.data ? transaction.data : '0x',
293
+ to: transaction.to,
294
+ /**
295
+ * if value is undefined, it will be set to 0x0 so the sponsorship
296
+ * check does not fail
297
+ */
298
+ value: transaction.value && viem.isHex(transaction.value)
299
+ ? viem.fromHex(transaction.value, 'bigint')
300
+ : viem.fromHex('0x0', 'bigint'),
301
+ }),
302
+ };
303
+ const result = yield kernelClientWithSponsorship.prepareUserOperationRequest({
304
+ account: kernelClientWithSponsorship.account,
305
+ userOperation,
306
+ });
307
+ if (!result)
308
+ return false;
309
+ return result.paymasterAndData !== '0x';
310
+ }
311
+ catch (err) {
312
+ logger.logger.debug(err);
313
+ return false;
314
+ }
315
+ });
316
+ }
317
+ disableGasSponsorshipOnce() {
318
+ this.isGasSponsorshipDisabled = true;
319
+ }
320
+ getBalance(address) {
321
+ return _tslib.__awaiter(this, void 0, void 0, function* () {
322
+ var _a;
323
+ const rpcClient = (_a = this.kernelClient) === null || _a === void 0 ? void 0 : _a.extend(viem.publicActions);
324
+ if (!rpcClient)
325
+ throw new utils.DynamicError('No RPC client');
326
+ return viem.formatEther(yield rpcClient.getBalance({ address: address }));
327
+ });
328
+ }
329
+ signMessage(messageToSign) {
330
+ return _tslib.__awaiter(this, void 0, void 0, function* () {
331
+ const client = yield this.getSigner();
332
+ const account = yield this.getAddress();
333
+ if (!account || !client)
334
+ return;
335
+ return client.signMessage({
336
+ account: account,
337
+ message: messageToSign,
338
+ });
339
+ });
340
+ }
341
+ createUiTransaction(from) {
342
+ return _tslib.__awaiter(this, void 0, void 0, function* () {
343
+ const walletClient = this.getWalletClient();
344
+ const publicClient = yield this.getPublicClient();
345
+ if (!publicClient || !walletClient) {
346
+ throw new utils.DynamicError('No public client available');
347
+ }
348
+ return viemUtils.createViemUiTransaction({ from, publicClient, walletClient });
349
+ });
350
+ }
351
+ }
352
+
353
+ exports.ZeroDevConnector = ZeroDevConnector;