@dynamic-labs/tempo 0.0.0 → 4.71.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.
@@ -0,0 +1,552 @@
1
+ 'use client'
2
+ 'use strict';
3
+
4
+ Object.defineProperty(exports, '__esModule', { value: true });
5
+
6
+ var _tslib = require('../../../_virtual/_tslib.cjs');
7
+ var viem = require('viem');
8
+ var accounts = require('viem/accounts');
9
+ var ethereumCore = require('@dynamic-labs/ethereum-core');
10
+ var logger$1 = require('@dynamic-labs/logger');
11
+ var sdkApiCore = require('@dynamic-labs/sdk-api-core');
12
+ var utils = require('@dynamic-labs/utils');
13
+ var waas = require('@dynamic-labs/waas');
14
+ var walletConnectorCore = require('@dynamic-labs/wallet-connector-core');
15
+ var TempoWalletConnector = require('../TempoWalletConnector/TempoWalletConnector.cjs');
16
+
17
+ const logger = new logger$1.Logger('DynamicWaasTempoConnector');
18
+ // Error message constants
19
+ const ERROR_SIGNED_SESSION_ID_REQUIRED = 'Signed session ID is required';
20
+ const ERROR_TEMPO_NETWORK_NOT_FOUND = 'Tempo network not found';
21
+ class DynamicWaasTempoConnector extends waas.withDynamicWaas(TempoWalletConnector.TempoWalletConnector) {
22
+ constructor(props) {
23
+ super(props);
24
+ this.name = 'Dynamic Waas';
25
+ this.logger = logger;
26
+ this.overrideKey = 'dynamicwaas';
27
+ this.isEmbeddedWallet = true;
28
+ this._selectedChainId = this.getLastUsedChainId();
29
+ this.__exportHandler = new waas.WaasExportHandler();
30
+ }
31
+ getLastUsedChainId() {
32
+ var _a;
33
+ logger.logVerboseTroubleshootingMessage('[DynamicWaasTempoConnector] getLastUsedChainId', {
34
+ evmNetworks: this.evmNetworks,
35
+ lastUsedChainId: this.lastUsedChainId,
36
+ });
37
+ if (this.lastUsedChainId) {
38
+ return this.lastUsedChainId;
39
+ }
40
+ if (!((_a = this.evmNetworks) === null || _a === void 0 ? void 0 : _a.length)) {
41
+ return undefined;
42
+ }
43
+ return this.evmNetworks[0].chainId;
44
+ }
45
+ set verifiedCredentials(verifiedCredentials) {
46
+ this._verifiedCredentials = verifiedCredentials;
47
+ }
48
+ get verifiedCredentials() {
49
+ return this._verifiedCredentials;
50
+ }
51
+ set verifiedCredential(verifiedCredential) {
52
+ this._verifiedCredential = verifiedCredential;
53
+ }
54
+ get verifiedCredential() {
55
+ return this._verifiedCredential;
56
+ }
57
+ setVerifiedCredentials(verifiedCredentials) {
58
+ // Filter for Tempo WaaS credentials
59
+ const tempoWaasVerifiedCredentials = verifiedCredentials === null || verifiedCredentials === void 0 ? void 0 : verifiedCredentials.filter((vc) => vc.walletName === 'dynamicwaas' && vc.chain === 'tempo');
60
+ const [tempoWaasVerifiedCredential] = tempoWaasVerifiedCredentials;
61
+ const didTempoWaasVerifiedCredentialsChanged = JSON.stringify(this.verifiedCredentials) !==
62
+ JSON.stringify(tempoWaasVerifiedCredentials);
63
+ if (!didTempoWaasVerifiedCredentialsChanged) {
64
+ return;
65
+ }
66
+ this.verifiedCredential = tempoWaasVerifiedCredential;
67
+ this.verifiedCredentials = tempoWaasVerifiedCredentials;
68
+ }
69
+ set lastUsedChainId(chainId) {
70
+ if (chainId === undefined) {
71
+ localStorage.removeItem(DynamicWaasTempoConnector.lastUsedChainIdStorageKey);
72
+ }
73
+ else {
74
+ localStorage.setItem(DynamicWaasTempoConnector.lastUsedChainIdStorageKey, chainId.toString());
75
+ }
76
+ this._selectedChainId = chainId;
77
+ }
78
+ get lastUsedChainId() {
79
+ var _a;
80
+ const lastUsedChainIdLS = localStorage.getItem(DynamicWaasTempoConnector.lastUsedChainIdStorageKey);
81
+ if (!lastUsedChainIdLS)
82
+ return undefined;
83
+ try {
84
+ const chainId = parseInt(lastUsedChainIdLS);
85
+ if (isNaN(chainId)) {
86
+ return undefined;
87
+ }
88
+ const isChainCurrentlyEnabled = this.evmNetworks.some((network) => network.chainId === chainId);
89
+ if (!isChainCurrentlyEnabled) {
90
+ if (!((_a = this.evmNetworks) === null || _a === void 0 ? void 0 : _a.length)) {
91
+ return undefined;
92
+ }
93
+ const lastUsedChainId = this.evmNetworks[0].chainId;
94
+ this.lastUsedChainId = lastUsedChainId;
95
+ return lastUsedChainId;
96
+ }
97
+ return chainId;
98
+ }
99
+ catch (err) {
100
+ logger.error(err);
101
+ return undefined;
102
+ }
103
+ }
104
+ get currentChainId() {
105
+ var _a, _b, _c;
106
+ return (_a = this._selectedChainId) !== null && _a !== void 0 ? _a : (_c = (_b = this.evmNetworks) === null || _b === void 0 ? void 0 : _b[0]) === null || _c === void 0 ? void 0 : _c.chainId;
107
+ }
108
+ getNetwork() {
109
+ return _tslib.__awaiter(this, void 0, void 0, function* () {
110
+ return this.currentChainId;
111
+ });
112
+ }
113
+ getEvmNetworkByChainId(chainId) {
114
+ return this.evmNetworks.find((network) => network.chainId === chainId);
115
+ }
116
+ currentEvmNetwork() {
117
+ const chainId = this.currentChainId;
118
+ if (!chainId) {
119
+ return undefined;
120
+ }
121
+ return this.getEvmNetworkByChainId(chainId);
122
+ }
123
+ switchNetwork(_a) {
124
+ return _tslib.__awaiter(this, arguments, void 0, function* ({ networkChainId, }) {
125
+ if (!networkChainId) {
126
+ return;
127
+ }
128
+ let networkChainIdInt = networkChainId;
129
+ if (typeof networkChainId === 'string') {
130
+ networkChainIdInt = parseInt(networkChainId);
131
+ }
132
+ this.lastUsedChainId = networkChainIdInt;
133
+ this._selectedChainId = networkChainIdInt;
134
+ this.emit('chainChange', {
135
+ chain: networkChainIdInt.toString(),
136
+ });
137
+ });
138
+ }
139
+ getRpcUrl() {
140
+ var _a;
141
+ const evmNetwork = this.currentEvmNetwork();
142
+ if (!evmNetwork) {
143
+ throw new Error(ERROR_TEMPO_NETWORK_NOT_FOUND);
144
+ }
145
+ return ((_a = evmNetwork === null || evmNetwork === void 0 ? void 0 : evmNetwork.privateCustomerRpcUrls) === null || _a === void 0 ? void 0 : _a[0]) || (evmNetwork === null || evmNetwork === void 0 ? void 0 : evmNetwork.rpcUrls[0]);
146
+ }
147
+ validateActiveWallet(expectedAddress) {
148
+ return _tslib.__awaiter(this, void 0, void 0, function* () {
149
+ var _a, _b;
150
+ const walletClient = yield this.getWaasWalletClient();
151
+ const targetWallet = yield walletClient.getWallet({
152
+ accountAddress: expectedAddress,
153
+ authToken: (_a = this.getAuthToken) === null || _a === void 0 ? void 0 : _a.call(this),
154
+ signedSessionId: '',
155
+ });
156
+ if (!targetWallet) {
157
+ throw new utils.DynamicError('Account not found');
158
+ }
159
+ const isWalletActive = walletConnectorCore.isSameAddress(targetWallet.accountAddress, ((_b = this.getActiveAccount()) === null || _b === void 0 ? void 0 : _b.address) || '', this.connectedChain);
160
+ if (!isWalletActive) {
161
+ this.setActiveAccount(targetWallet.accountAddress);
162
+ }
163
+ });
164
+ }
165
+ getActiveAccountAddress() {
166
+ return _tslib.__awaiter(this, void 0, void 0, function* () {
167
+ var _a;
168
+ return (_a = this.getActiveAccount()) === null || _a === void 0 ? void 0 : _a.address;
169
+ });
170
+ }
171
+ getViemAccountCustomSource(_a) {
172
+ return _tslib.__awaiter(this, arguments, void 0, function* ({ accountAddress, }) {
173
+ var _b;
174
+ const client = yield this.getWaasWalletClient();
175
+ const signedSessionId = yield ((_b = this.getSignedSessionId) === null || _b === void 0 ? void 0 : _b.call(this));
176
+ if (!signedSessionId) {
177
+ throw new utils.DynamicError(ERROR_SIGNED_SESSION_ID_REQUIRED);
178
+ }
179
+ return {
180
+ address: accountAddress,
181
+ signMessage: (_c) => _tslib.__awaiter(this, [_c], void 0, function* ({ message, }) {
182
+ var _d;
183
+ const traceId = this.generateTraceId();
184
+ const startTime = Date.now();
185
+ this.instrument('[signMessage] start', {
186
+ accountAddress,
187
+ chainName: 'TEMPO',
188
+ key: 'signMessage-start',
189
+ startTime,
190
+ time: 0,
191
+ traceId,
192
+ });
193
+ const mfaToken = yield ((_d = this.getMfaToken) === null || _d === void 0 ? void 0 : _d.call(this, {
194
+ mfaAction: sdkApiCore.MFAAction.WalletWaasSign,
195
+ }));
196
+ const password = yield this.getPasswordIfNeeded({
197
+ accountAddress,
198
+ });
199
+ const signature = yield this.instrumentAsync({
200
+ context: { chainName: 'TEMPO', startTime, traceId },
201
+ fn: () => _tslib.__awaiter(this, void 0, void 0, function* () {
202
+ var _e;
203
+ return client.signMessage({
204
+ accountAddress,
205
+ authToken: (_e = this.getAuthToken) === null || _e === void 0 ? void 0 : _e.call(this),
206
+ message: message,
207
+ mfaToken,
208
+ password,
209
+ signedSessionId,
210
+ traceContext: {
211
+ startTime,
212
+ traceId,
213
+ },
214
+ });
215
+ }),
216
+ operation: 'signMessage',
217
+ resource: 'client.signMessage',
218
+ });
219
+ return signature;
220
+ }),
221
+ signTransaction: (transaction) => _tslib.__awaiter(this, void 0, void 0, function* () {
222
+ var _f;
223
+ const traceId = this.generateTraceId();
224
+ const startTime = Date.now();
225
+ this.instrument('[signTransaction] start', {
226
+ accountAddress,
227
+ chainName: 'TEMPO',
228
+ key: 'signTransaction-start',
229
+ startTime,
230
+ time: 0,
231
+ traceId,
232
+ });
233
+ const mfaToken = yield ((_f = this.getMfaToken) === null || _f === void 0 ? void 0 : _f.call(this, {
234
+ mfaAction: sdkApiCore.MFAAction.WalletWaasSign,
235
+ }));
236
+ const password = yield this.getPasswordIfNeeded({ accountAddress });
237
+ // Ensure chainId is set so the signed transaction matches the RPC's chain (EIP-155).
238
+ // Wrong chainId causes "invalid signature: Failed to recover the signer" on broadcast.
239
+ const { currentChainId } = this;
240
+ const transactionWithChainId = currentChainId !== undefined
241
+ ? Object.assign(Object.assign({}, transaction), { chainId: currentChainId }) : transaction;
242
+ const tx = yield this.instrumentAsync({
243
+ context: { chainName: 'TEMPO', startTime, traceId },
244
+ fn: () => _tslib.__awaiter(this, void 0, void 0, function* () {
245
+ var _g;
246
+ return client.signTransaction(Object.assign(Object.assign({ authToken: (_g = this.getAuthToken) === null || _g === void 0 ? void 0 : _g.call(this) }, (currentChainId !== undefined && {
247
+ chainId: currentChainId.toString(),
248
+ })), { mfaToken,
249
+ password, senderAddress: accountAddress, signedSessionId, traceContext: {
250
+ startTime,
251
+ traceId,
252
+ }, transaction: viem.serializeTransaction(transactionWithChainId) }));
253
+ }),
254
+ operation: 'signTransaction',
255
+ resource: 'client.signTransaction',
256
+ });
257
+ return tx;
258
+ }),
259
+ signTypedData: (typedData) => _tslib.__awaiter(this, void 0, void 0, function* () {
260
+ var _h;
261
+ const traceId = this.generateTraceId();
262
+ const startTime = Date.now();
263
+ this.instrument('[signTypedData] start', {
264
+ accountAddress,
265
+ chainName: 'TEMPO',
266
+ key: 'signTypedData-start',
267
+ startTime,
268
+ time: 0,
269
+ traceId,
270
+ });
271
+ const mfaToken = yield ((_h = this.getMfaToken) === null || _h === void 0 ? void 0 : _h.call(this, {
272
+ mfaAction: sdkApiCore.MFAAction.WalletWaasSign,
273
+ }));
274
+ const password = yield this.getPasswordIfNeeded({ accountAddress });
275
+ const signature = yield this.instrumentAsync({
276
+ context: { chainName: 'TEMPO', startTime, traceId },
277
+ fn: () => _tslib.__awaiter(this, void 0, void 0, function* () {
278
+ var _j;
279
+ return client.signTypedData({
280
+ accountAddress,
281
+ authToken: (_j = this.getAuthToken) === null || _j === void 0 ? void 0 : _j.call(this),
282
+ mfaToken,
283
+ password,
284
+ signedSessionId,
285
+ traceContext: {
286
+ startTime,
287
+ traceId,
288
+ },
289
+ typedData: typedData,
290
+ });
291
+ }),
292
+ operation: 'signTypedData',
293
+ resource: 'client.signTypedData',
294
+ });
295
+ return signature;
296
+ }),
297
+ };
298
+ });
299
+ }
300
+ getViemAccount(_a) {
301
+ return _tslib.__awaiter(this, arguments, void 0, function* ({ accountAddress, }) {
302
+ const accountSource = yield this.getViemAccountCustomSource({
303
+ accountAddress,
304
+ });
305
+ return accounts.toAccount(accountSource);
306
+ });
307
+ }
308
+ getWalletClient(chainId) {
309
+ var _a, _b;
310
+ const targetAccountAddress = (_a = this.getActiveAccount()) === null || _a === void 0 ? void 0 : _a.address;
311
+ if (!targetAccountAddress) {
312
+ return undefined;
313
+ }
314
+ // Resolve the network first, then get RPC URL from that network
315
+ // This ensures the RPC URL matches the resolved chain when chainId is provided
316
+ const evmNetwork = chainId
317
+ ? this.getEvmNetworkByChainId(parseInt(chainId))
318
+ : this.currentEvmNetwork();
319
+ if (!evmNetwork) {
320
+ throw new Error(ERROR_TEMPO_NETWORK_NOT_FOUND);
321
+ }
322
+ const rpcUrl = ((_b = evmNetwork.privateCustomerRpcUrls) === null || _b === void 0 ? void 0 : _b[0]) || evmNetwork.rpcUrls[0];
323
+ return ethereumCore.createWalletClientWithUiConfirmation({
324
+ account: () => _tslib.__awaiter(this, void 0, void 0, function* () {
325
+ return this.getViemAccount({
326
+ accountAddress: targetAccountAddress,
327
+ });
328
+ }),
329
+ address: targetAccountAddress,
330
+ chain: ethereumCore.getOrMapViemChain(evmNetwork),
331
+ transport: viem.http(rpcUrl, this.providersConfig.httpTransportConfig),
332
+ walletConnector: this,
333
+ walletUiUtils: this.walletUiUtils,
334
+ });
335
+ }
336
+ getPublicClient() {
337
+ return _tslib.__awaiter(this, void 0, void 0, function* () {
338
+ var _a;
339
+ const evmNetwork = this.currentEvmNetwork();
340
+ if (!evmNetwork) {
341
+ throw new utils.DynamicError(ERROR_TEMPO_NETWORK_NOT_FOUND);
342
+ }
343
+ const rpcUrl = ((_a = evmNetwork.privateCustomerRpcUrls) === null || _a === void 0 ? void 0 : _a[0]) || evmNetwork.rpcUrls[0];
344
+ return viem.createPublicClient({
345
+ chain: ethereumCore.getOrMapViemChain(evmNetwork),
346
+ transport: viem.http(rpcUrl, this.providersConfig.httpTransportConfig),
347
+ });
348
+ });
349
+ }
350
+ signMessage(message) {
351
+ var _a;
352
+ return (_a = this.getWalletClient()) === null || _a === void 0 ? void 0 : _a.signMessage({ message });
353
+ }
354
+ signMessageWithContext(_a) {
355
+ return _tslib.__awaiter(this, arguments, void 0, function* ({ message, context, }) {
356
+ var _b, _c, _d, _e;
357
+ const walletClient = yield this.getWaasWalletClient();
358
+ const signedSessionId = yield ((_b = this.getSignedSessionId) === null || _b === void 0 ? void 0 : _b.call(this));
359
+ if (!signedSessionId) {
360
+ throw new utils.DynamicError(ERROR_SIGNED_SESSION_ID_REQUIRED);
361
+ }
362
+ const accountAddress = (_c = this.getActiveAccount()) === null || _c === void 0 ? void 0 : _c.address;
363
+ const mfaToken = yield ((_d = this.getMfaToken) === null || _d === void 0 ? void 0 : _d.call(this, {
364
+ mfaAction: sdkApiCore.MFAAction.WalletWaasSign,
365
+ }));
366
+ const password = yield this.getPasswordIfNeeded({ accountAddress });
367
+ const traceId = this.generateTraceId();
368
+ const startTime = Date.now();
369
+ this.instrument('[signMessageWithContext] start', {
370
+ key: 'signMessageWithContext-start',
371
+ startTime,
372
+ time: 0,
373
+ traceId,
374
+ });
375
+ return walletClient.signMessage({
376
+ accountAddress,
377
+ authToken: (_e = this.getAuthToken) === null || _e === void 0 ? void 0 : _e.call(this),
378
+ context,
379
+ message,
380
+ mfaToken,
381
+ password,
382
+ signedSessionId,
383
+ traceContext: {
384
+ startTime,
385
+ traceId,
386
+ },
387
+ });
388
+ });
389
+ }
390
+ getSigner() {
391
+ return _tslib.__awaiter(this, void 0, void 0, function* () {
392
+ return this.getWalletClient();
393
+ });
394
+ }
395
+ getWalletClientByAddress({ accountAddress, }) {
396
+ this.setActiveAccount(accountAddress);
397
+ return this.getWalletClient();
398
+ }
399
+ createUiTransaction(from) {
400
+ return _tslib.__awaiter(this, void 0, void 0, function* () {
401
+ yield this.validateActiveWallet(from);
402
+ const walletClient = this.getWalletClient();
403
+ const publicClient = yield this.getPublicClient();
404
+ if (!publicClient || !walletClient) {
405
+ throw new utils.DynamicError('No public client available');
406
+ }
407
+ const uiTransaction = new ethereumCore.ViemUiTransaction({
408
+ account: from,
409
+ onSubmit: (transaction) => _tslib.__awaiter(this, void 0, void 0, function* () {
410
+ var _a, _b, _c;
411
+ // Build native Tempo type 118 transaction with fee token support
412
+ const chainId = yield this.getNetwork();
413
+ if (!chainId) {
414
+ throw new utils.DynamicError('No chain ID available');
415
+ }
416
+ // Build the call data for the transaction
417
+ const callData = transaction.nonNativeAddress
418
+ ? {
419
+ // TIP-20/ERC-20 transfer - encode the transfer call
420
+ data: viem.encodeFunctionData({
421
+ abi: viem.erc20Abi,
422
+ args: [
423
+ transaction.to,
424
+ transaction.nonNativeValue,
425
+ ],
426
+ functionName: 'transfer',
427
+ }),
428
+ to: transaction.nonNativeAddress,
429
+ value: BigInt(0),
430
+ }
431
+ : {
432
+ // Native transfer (Tempo has no native token, but handle for compatibility)
433
+ data: '0x',
434
+ to: (transaction.to || ''),
435
+ value: (_a = transaction.value) !== null && _a !== void 0 ? _a : BigInt(0),
436
+ };
437
+ // Get standard sequential nonce
438
+ const nonce = yield publicClient.getTransactionCount({
439
+ address: from,
440
+ });
441
+ // Estimate gas for the call
442
+ const gasEstimate = yield publicClient.estimateGas({
443
+ account: from,
444
+ data: callData.data,
445
+ to: callData.to,
446
+ value: callData.value,
447
+ });
448
+ // Add 30% buffer for Tempo AA overhead + 300k minimum floor for nonce lane init
449
+ const gasWithBuffer = (gasEstimate * BigInt(130)) / BigInt(100);
450
+ const minGas = BigInt(300000);
451
+ const gas = gasWithBuffer > minGas ? gasWithBuffer : minGas;
452
+ // Get gas price
453
+ const gasPrice = yield publicClient.getGasPrice();
454
+ // Build Tempo transaction with proper types (BigInt values)
455
+ const tempoTx = Object.assign({ calls: [callData], chainId,
456
+ gas, maxFeePerGas: gasPrice, maxPriorityFeePerGas: gasPrice / BigInt(10), nonce }, (transaction.feeTokenAddress && {
457
+ feeToken: transaction.feeTokenAddress,
458
+ }));
459
+ // Get WaaS client and sign the native Tempo transaction
460
+ const waasClient = yield this.getWaasWalletClient();
461
+ const signedSessionId = yield ((_b = this.getSignedSessionId) === null || _b === void 0 ? void 0 : _b.call(this));
462
+ if (!signedSessionId) {
463
+ throw new utils.DynamicError(ERROR_SIGNED_SESSION_ID_REQUIRED);
464
+ }
465
+ const mfaToken = yield ((_c = this.getMfaToken) === null || _c === void 0 ? void 0 : _c.call(this, {
466
+ mfaAction: sdkApiCore.MFAAction.WalletWaasSign,
467
+ }));
468
+ const password = yield this.getPasswordIfNeeded({
469
+ accountAddress: from,
470
+ });
471
+ const traceId = this.generateTraceId();
472
+ const startTime = Date.now();
473
+ // Sign the Tempo transaction
474
+ const signature = yield this.instrumentAsync({
475
+ context: { chainName: 'TEMPO', startTime, traceId },
476
+ fn: () => _tslib.__awaiter(this, void 0, void 0, function* () {
477
+ var _d;
478
+ return waasClient.signTransaction({
479
+ authToken: (_d = this.getAuthToken) === null || _d === void 0 ? void 0 : _d.call(this),
480
+ mfaToken,
481
+ password,
482
+ senderAddress: from,
483
+ signedSessionId,
484
+ traceContext: {
485
+ startTime,
486
+ traceId,
487
+ },
488
+ // Use replacer to convert BigInt to string for JSON serialization
489
+ transaction: JSON.stringify(tempoTx, (_, v) => typeof v === 'bigint' ? v.toString() : v),
490
+ });
491
+ }),
492
+ operation: 'signTempoTransaction',
493
+ resource: 'waasClient.signTransaction',
494
+ });
495
+ // Broadcast using sendRawTransaction
496
+ const hash = yield publicClient.sendRawTransaction({
497
+ serializedTransaction: signature,
498
+ });
499
+ return hash;
500
+ }),
501
+ publicClient,
502
+ transaction: {},
503
+ });
504
+ uiTransaction.chain = 'TEMPO';
505
+ uiTransaction.getBalance = () => Promise.resolve(BigInt(0));
506
+ // Mark as "gas sponsored" so insufficient funds check doesn't compare
507
+ // native balance (0) vs gas fees - Tempo fees are paid in TIP-20 tokens
508
+ uiTransaction.isGasSponsored = () => true;
509
+ return uiTransaction;
510
+ });
511
+ }
512
+ getConnectedAccounts() {
513
+ return _tslib.__awaiter(this, void 0, void 0, function* () {
514
+ var _a;
515
+ const verifiedCredentials = this.verifiedCredentials || [];
516
+ const addresses = verifiedCredentials
517
+ .map((vc) => vc === null || vc === void 0 ? void 0 : vc.address)
518
+ .filter((a) => typeof a === 'string');
519
+ if (addresses.length > 0 && ((_a = this.verifiedCredential) === null || _a === void 0 ? void 0 : _a.address)) {
520
+ this.setActiveAccount(this.verifiedCredential.address);
521
+ }
522
+ return addresses;
523
+ });
524
+ }
525
+ getAddress() {
526
+ return _tslib.__awaiter(this, void 0, void 0, function* () {
527
+ var _a;
528
+ const activeAccount = this.getActiveAccount();
529
+ if (!activeAccount || !activeAccount.address) {
530
+ // If no active account, try to get one from verified credentials
531
+ if ((_a = this.verifiedCredential) === null || _a === void 0 ? void 0 : _a.address) {
532
+ const { address } = this.verifiedCredential;
533
+ this.setActiveAccount(address);
534
+ return address;
535
+ }
536
+ throw new utils.DynamicError('No active wallet address found');
537
+ }
538
+ return activeAccount.address;
539
+ });
540
+ }
541
+ endSession() {
542
+ const _super = Object.create(null, {
543
+ endSession: { get: () => super.endSession }
544
+ });
545
+ return _tslib.__awaiter(this, void 0, void 0, function* () {
546
+ yield _super.endSession.call(this);
547
+ });
548
+ }
549
+ }
550
+ DynamicWaasTempoConnector.lastUsedChainIdStorageKey = 'dynamic-waas-tempo-last-used-chain-id';
551
+
552
+ exports.DynamicWaasTempoConnector = DynamicWaasTempoConnector;