@dynamic-labs/waas-svm 4.25.2 → 4.25.4

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,29 @@
1
1
 
2
+ ### [4.25.4](https://github.com/dynamic-labs/dynamic-auth/compare/v4.25.3...v4.25.4) (2025-07-25)
3
+
4
+
5
+ ### Features
6
+
7
+ * add passkey as a sign in method ([#9210](https://github.com/dynamic-labs/dynamic-auth/issues/9210)) ([90a6938](https://github.com/dynamic-labs/dynamic-auth/commit/90a69389cf89d7092519e58b0052d85c53a19905))
8
+
9
+
10
+ ### Bug Fixes
11
+
12
+ * **QNTM-3416:** fix rainbow wallet connection on base network ([#9227](https://github.com/dynamic-labs/dynamic-auth/issues/9227)) ([d6dcdc3](https://github.com/dynamic-labs/dynamic-auth/commit/d6dcdc3ead194d7580bb8387432dfd15555158de))
13
+
14
+ ### [4.25.3](https://github.com/dynamic-labs/dynamic-auth/compare/v4.25.2...v4.25.3) (2025-07-22)
15
+
16
+
17
+ ### Features
18
+
19
+ * add permanentlyDeleteUser for react native ([#8838](https://github.com/dynamic-labs/dynamic-auth/issues/8838)) ([1e00fd1](https://github.com/dynamic-labs/dynamic-auth/commit/1e00fd166f2cef55cd0526a66d9bb3123d10504f))
20
+
21
+
22
+ ### Bug Fixes
23
+
24
+ * chain id on dynamic waas for confirmation view and clean up tests ([#9204](https://github.com/dynamic-labs/dynamic-auth/issues/9204)) ([4cebd8b](https://github.com/dynamic-labs/dynamic-auth/commit/4cebd8b63c9327d936ebe1c2305eb4e8f5f69aeb))
25
+ * remove errant calls to fetchMultichainTokenBalances from useEffect ([#9207](https://github.com/dynamic-labs/dynamic-auth/issues/9207)) ([84bacfc](https://github.com/dynamic-labs/dynamic-auth/commit/84bacfc1ddd6b18fde9ba1baed310531b3ec0adc))
26
+
2
27
  ### [4.25.2](https://github.com/dynamic-labs/dynamic-auth/compare/v4.25.1...v4.25.2) (2025-07-18)
3
28
 
4
29
 
package/package.cjs CHANGED
@@ -3,6 +3,6 @@
3
3
 
4
4
  Object.defineProperty(exports, '__esModule', { value: true });
5
5
 
6
- var version = "4.25.2";
6
+ var version = "4.25.4";
7
7
 
8
8
  exports.version = version;
package/package.js CHANGED
@@ -1,4 +1,4 @@
1
1
  'use client'
2
- var version = "4.25.2";
2
+ var version = "4.25.4";
3
3
 
4
4
  export { version };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dynamic-labs/waas-svm",
3
- "version": "4.25.2",
3
+ "version": "4.25.4",
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",
@@ -21,14 +21,14 @@
21
21
  "@solana/web3.js": "1.98.1",
22
22
  "eventemitter3": "5.0.1",
23
23
  "bs58": "5.0.0",
24
- "@dynamic-labs/assert-package-version": "4.25.2",
25
- "@dynamic-labs/logger": "4.25.2",
26
- "@dynamic-labs/rpc-providers": "4.25.2",
27
- "@dynamic-labs/solana-core": "4.25.2",
28
- "@dynamic-labs/types": "4.25.2",
29
- "@dynamic-labs/utils": "4.25.2",
30
- "@dynamic-labs/waas": "4.25.2",
31
- "@dynamic-labs/wallet-connector-core": "4.25.2"
24
+ "@dynamic-labs/assert-package-version": "4.25.4",
25
+ "@dynamic-labs/logger": "4.25.4",
26
+ "@dynamic-labs/rpc-providers": "4.25.4",
27
+ "@dynamic-labs/solana-core": "4.25.4",
28
+ "@dynamic-labs/types": "4.25.4",
29
+ "@dynamic-labs/utils": "4.25.4",
30
+ "@dynamic-labs/waas": "4.25.4",
31
+ "@dynamic-labs/wallet-connector-core": "4.25.4"
32
32
  },
33
33
  "peerDependencies": {}
34
34
  }
@@ -12,21 +12,6 @@ var walletConnectorCore = require('@dynamic-labs/wallet-connector-core');
12
12
  var logger = require('../../utils/logger.cjs');
13
13
  var DynamicWaasSVMSigner = require('../signer/DynamicWaasSVMSigner.cjs');
14
14
 
15
- // This will need to be moved to a base class once we have base classes for waas connectors
16
- class WaasExportHandler {
17
- constructor() {
18
- this.iframeStamper = null;
19
- }
20
- setIframeStamper(iframe) {
21
- this.iframeStamper = iframe;
22
- }
23
- clear() {
24
- if (this.iframeStamper) {
25
- this.iframeStamper.remove();
26
- this.iframeStamper = null;
27
- }
28
- }
29
- }
30
15
  class DynamicWaasSVMConnector extends waas.withDynamicWaas(solanaCore.SolanaWalletConnector) {
31
16
  connect() {
32
17
  throw new Error('Method not implemented.');
@@ -37,16 +22,23 @@ class DynamicWaasSVMConnector extends waas.withDynamicWaas(solanaCore.SolanaWall
37
22
  this.overrideKey = 'dynamicwaas';
38
23
  this.isEmbeddedWallet = true;
39
24
  this.walletUiUtils = props.walletUiUtils;
40
- this.__exportHandler = new WaasExportHandler();
41
25
  }
42
26
  setActiveAccountAddress(accountAddress) {
43
27
  this.activeAccountAddress = accountAddress;
44
28
  }
29
+ getActiveAccountAddress() {
30
+ return _tslib.__awaiter(this, void 0, void 0, function* () {
31
+ return this.activeAccountAddress;
32
+ });
33
+ }
45
34
  validateActiveWallet(expectedAddress) {
46
35
  return _tslib.__awaiter(this, void 0, void 0, function* () {
47
36
  var _a, _b;
48
37
  const walletClient = yield this.getWaasWalletClient();
49
38
  const signedSessionId = yield ((_a = this.getSignedSessionId) === null || _a === void 0 ? void 0 : _a.call(this));
39
+ if (!signedSessionId) {
40
+ throw new utils.DynamicError('Signed session ID is required');
41
+ }
50
42
  const targetWallet = yield walletClient.getWallet({
51
43
  accountAddress: expectedAddress,
52
44
  authToken: (_b = this.getAuthToken) === null || _b === void 0 ? void 0 : _b.call(this),
@@ -61,31 +53,23 @@ class DynamicWaasSVMConnector extends waas.withDynamicWaas(solanaCore.SolanaWall
61
53
  }
62
54
  });
63
55
  }
64
- createWalletAccount() {
65
- return _tslib.__awaiter(this, arguments, void 0, function* ({ thresholdSignatureScheme = 'TWO_OF_TWO', } = {}) {
66
- var _a, _b;
67
- const walletClient = yield this.getWaasWalletClient();
68
- const signedSessionId = yield ((_a = this.getSignedSessionId) === null || _a === void 0 ? void 0 : _a.call(this));
69
- const createdWallet = yield walletClient.createWalletAccount({
70
- authToken: (_b = this.getAuthToken) === null || _b === void 0 ? void 0 : _b.call(this),
71
- signedSessionId,
72
- thresholdSignatureScheme: thresholdSignatureScheme,
73
- });
74
- return createdWallet;
75
- });
76
- }
77
56
  internalSignMessage(message) {
78
57
  return _tslib.__awaiter(this, void 0, void 0, function* () {
79
- var _a, _b;
58
+ var _a, _b, _c;
80
59
  const walletClient = yield this.getWaasWalletClient();
81
60
  if (!this.activeAccountAddress) {
82
61
  throw new Error('Active account address is required');
83
62
  }
84
63
  const signedSessionId = yield ((_a = this.getSignedSessionId) === null || _a === void 0 ? void 0 : _a.call(this));
64
+ if (!signedSessionId) {
65
+ throw new utils.DynamicError('Signed session ID is required');
66
+ }
67
+ const mfaToken = yield ((_b = this.getMfaToken) === null || _b === void 0 ? void 0 : _b.call(this));
85
68
  const signedMessage = yield walletClient.signMessage({
86
69
  accountAddress: this.activeAccountAddress,
87
- authToken: (_b = this.getAuthToken) === null || _b === void 0 ? void 0 : _b.call(this),
70
+ authToken: (_c = this.getAuthToken) === null || _c === void 0 ? void 0 : _c.call(this),
88
71
  message,
72
+ mfaToken,
89
73
  signedSessionId,
90
74
  });
91
75
  return signedMessage;
@@ -105,18 +89,23 @@ class DynamicWaasSVMConnector extends waas.withDynamicWaas(solanaCore.SolanaWall
105
89
  }
106
90
  internalSignTransaction(transaction) {
107
91
  return _tslib.__awaiter(this, void 0, void 0, function* () {
108
- var _a, _b;
92
+ var _a, _b, _c;
109
93
  const walletClient = yield this.getWaasWalletClient();
110
94
  const signedSessionId = yield ((_a = this.getSignedSessionId) === null || _a === void 0 ? void 0 : _a.call(this));
95
+ if (!signedSessionId) {
96
+ throw new utils.DynamicError('Signed session ID is required');
97
+ }
111
98
  if (!this.activeAccountAddress) {
112
99
  throw new Error('Active account address is required');
113
100
  }
101
+ const mfaToken = yield ((_b = this.getMfaToken) === null || _b === void 0 ? void 0 : _b.call(this));
114
102
  const messageBytes = transaction instanceof web3_js.Transaction
115
103
  ? transaction.serializeMessage()
116
104
  : transaction.message.serialize();
117
105
  const messageToSign = Buffer.from(messageBytes).toString('hex');
118
106
  const signature = yield walletClient.signTransaction({
119
- authToken: (_b = this.getAuthToken) === null || _b === void 0 ? void 0 : _b.call(this),
107
+ authToken: (_c = this.getAuthToken) === null || _c === void 0 ? void 0 : _c.call(this),
108
+ mfaToken,
120
109
  senderAddress: this.activeAccountAddress,
121
110
  signedSessionId,
122
111
  transaction: messageToSign,
@@ -228,114 +217,19 @@ class DynamicWaasSVMConnector extends waas.withDynamicWaas(solanaCore.SolanaWall
228
217
  this.setActiveAccountAddress(accountAddress);
229
218
  return this.getWalletClient();
230
219
  }
231
- exportPrivateKey() {
232
- return _tslib.__awaiter(this, arguments, void 0, function* ({ accountAddress, displayContainer, password, } = {}) {
233
- var _a;
234
- const walletClient = yield this.getWaasWalletClient();
235
- const targetAccountAddress = accountAddress || this.activeAccountAddress;
236
- if (!targetAccountAddress) {
237
- throw new Error('Account address is required');
238
- }
239
- if (!displayContainer) {
240
- throw new Error('Missing display container for export private key');
241
- }
242
- this.__exportHandler.setIframeStamper(displayContainer);
243
- yield walletClient.exportPrivateKey({
244
- accountAddress: targetAccountAddress,
245
- authToken: (_a = this.getAuthToken) === null || _a === void 0 ? void 0 : _a.call(this),
246
- displayContainer,
247
- password,
248
- });
249
- });
250
- }
251
- getExportHandler() {
252
- return this.__exportHandler;
253
- }
254
- importPrivateKey(_a) {
255
- return _tslib.__awaiter(this, arguments, void 0, function* ({ privateKey, thresholdSignatureScheme = 'TWO_OF_TWO', }) {
256
- var _b, _c;
257
- const walletClient = yield this.getWaasWalletClient();
258
- const signedSessionId = yield ((_b = this.getSignedSessionId) === null || _b === void 0 ? void 0 : _b.call(this));
259
- if (!signedSessionId) {
260
- throw new Error('Signed session ID is required');
261
- }
262
- yield walletClient.importPrivateKey({
263
- authToken: (_c = this.getAuthToken) === null || _c === void 0 ? void 0 : _c.call(this),
264
- privateKey,
265
- signedSessionId,
266
- thresholdSignatureScheme: thresholdSignatureScheme,
267
- });
268
- });
269
- }
270
- backupKeySharesToGoogleDrive(_a) {
271
- return _tslib.__awaiter(this, arguments, void 0, function* ({ accountAddress, password, }) {
272
- if (!accountAddress) {
273
- throw new Error('Account address is required');
274
- }
275
- const walletClient = yield this.getWaasWalletClient();
276
- return walletClient.backupKeySharesToGoogleDrive({
277
- accountAddress,
278
- password,
279
- });
280
- });
281
- }
282
- refreshWalletAccountShares(_a) {
283
- return _tslib.__awaiter(this, arguments, void 0, function* ({ accountAddress, password, }) {
284
- if (!accountAddress) {
285
- throw new Error('Account address is required');
286
- }
287
- const walletClient = yield this.getWaasWalletClient();
288
- return walletClient.refreshWalletAccountShares({
289
- accountAddress,
290
- password,
291
- });
292
- });
293
- }
294
- updatePassword(_a) {
295
- return _tslib.__awaiter(this, arguments, void 0, function* ({ accountAddress, existingPassword, newPassword, }) {
296
- if (!accountAddress) {
297
- throw new Error('Account address is required');
298
- }
299
- const walletClient = yield this.getWaasWalletClient();
300
- return walletClient.updatePassword({
301
- accountAddress,
302
- existingPassword,
303
- newPassword,
304
- });
305
- });
306
- }
307
- signRawMessage(_a) {
308
- return _tslib.__awaiter(this, arguments, void 0, function* ({ accountAddress, message, }) {
309
- if (!accountAddress) {
310
- throw new Error('Account address is required');
311
- }
312
- if (message.length !== 64) {
313
- throw new Error('Message must be 64 characters long');
314
- }
315
- const walletClient = yield this.getWaasWalletClient();
316
- return walletClient.signRawMessage({
317
- accountAddress,
318
- message,
319
- });
320
- });
321
- }
220
+ // Chain-specific override for exportClientKeyshares - SVM needs to handle optional account address
322
221
  exportClientKeyshares(_a) {
222
+ const _super = Object.create(null, {
223
+ exportClientKeyshares: { get: () => super.exportClientKeyshares }
224
+ });
323
225
  return _tslib.__awaiter(this, arguments, void 0, function* ({ accountAddress, password, }) {
324
- var _b, _c;
325
- const walletClient = yield this.getWaasWalletClient();
326
226
  const targetAccountAddress = accountAddress || this.activeAccountAddress;
327
- const signedSessionId = yield ((_b = this.getSignedSessionId) === null || _b === void 0 ? void 0 : _b.call(this));
328
227
  if (!targetAccountAddress) {
329
228
  throw new Error('Account address is required');
330
229
  }
331
- if (!signedSessionId) {
332
- throw new Error('Signed session ID is required');
333
- }
334
- yield walletClient.exportClientKeyshares({
230
+ return _super.exportClientKeyshares.call(this, {
335
231
  accountAddress: targetAccountAddress,
336
- authToken: (_c = this.getAuthToken) === null || _c === void 0 ? void 0 : _c.call(this),
337
232
  password,
338
- signedSessionId,
339
233
  });
340
234
  });
341
235
  }
@@ -355,12 +249,11 @@ class DynamicWaasSVMConnector extends waas.withDynamicWaas(solanaCore.SolanaWall
355
249
  });
356
250
  }
357
251
  endSession() {
252
+ const _super = Object.create(null, {
253
+ endSession: { get: () => super.endSession }
254
+ });
358
255
  return _tslib.__awaiter(this, void 0, void 0, function* () {
359
- const waasSvmClient = yield this.getWaasWalletClient();
360
- if (!waasSvmClient) {
361
- return;
362
- }
363
- yield waasSvmClient.cleanup();
256
+ yield _super.endSession.call(this);
364
257
  });
365
258
  }
366
259
  }
@@ -11,80 +11,95 @@ declare const DynamicWaasSVMConnector_base: (abstract new (...args: any[]) => {
11
11
  overrideKey: string;
12
12
  isEmbeddedWallet: boolean;
13
13
  getSignedSessionId?: (() => Promise<string>) | undefined;
14
+ getMfaToken?: (() => Promise<string | undefined>) | undefined;
14
15
  getAuthToken?: (() => string) | undefined;
15
16
  environmentId?: string | undefined;
16
17
  baseApiUrl?: string | undefined;
17
18
  relayUrl?: string | undefined;
18
19
  dynamicWaasClient: import("@dynamic-labs-wallet/browser-wallet-client").DynamicWalletClient | undefined;
19
20
  chainName: string;
21
+ __exportHandler: import("@dynamic-labs/waas").WaasExportHandler;
22
+ validateActiveWallet(expectedAddress: string): Promise<void>;
20
23
  setGetAuthTokenFunction(getAuthToken: () => string): void;
24
+ setGetMfaTokenFunction(getMfaToken: () => Promise<string | undefined>): void;
21
25
  setEnvironmentId(environmentId: string): void;
22
26
  setBaseApiUrl(baseApiUrl: string): void;
23
27
  setRelayUrl(relayUrl: string): void;
24
28
  setGetSignedSessionIdFunction(getSignedSessionId: () => Promise<string>): void;
29
+ delegateKeyShares({ accountAddress, password, }: {
30
+ accountAddress: string;
31
+ password?: string | undefined;
32
+ }): Promise<void>;
25
33
  createDynamicWaasClient(): Promise<import("@dynamic-labs-wallet/browser-wallet-client").DynamicWalletClient>;
26
34
  getWaasWalletClient(): Promise<import("@dynamic-labs-wallet/browser-wallet-client").DynamicWalletClient>;
27
- }) & typeof SolanaWalletConnector;
28
- export declare class DynamicWaasSVMConnector extends DynamicWaasSVMConnector_base implements IDynamicWaasConnector {
29
- connect(): Promise<void>;
30
- name: string;
31
- overrideKey: string;
32
- isEmbeddedWallet: boolean;
33
- private __exportHandler;
34
- activeAccountAddress: string | undefined;
35
- protected walletUiUtils: WalletUiUtils<InternalWalletConnector>;
36
- constructor(props: DynamicWaasSVMConnectorProps);
37
- private setActiveAccountAddress;
38
- validateActiveWallet(expectedAddress: string): Promise<void>;
39
35
  createWalletAccount({ thresholdSignatureScheme, }?: {
40
- thresholdSignatureScheme?: string;
41
- }): Promise<{
36
+ thresholdSignatureScheme?: string | undefined;
37
+ } | undefined): Promise<{
42
38
  chainName: string;
43
39
  accountAddress: string;
44
40
  publicKeyHex: string;
45
41
  rawPublicKey: string | Uint8Array | undefined;
46
42
  }>;
47
- internalSignMessage(message: string): Promise<string>;
48
- signMessage(message: string): Promise<string>;
49
- internalSignTransaction<T extends Transaction | VersionedTransaction>(transaction: T): Promise<Transaction | VersionedTransaction>;
50
- signTransaction<T extends Transaction | VersionedTransaction>(transaction: T): Promise<Transaction | VersionedTransaction>;
51
- internalSignAllTransactions<T extends Transaction | VersionedTransaction>(transactions: T[]): Promise<(Transaction | VersionedTransaction)[]>;
52
- signAllTransactions<T extends Transaction | VersionedTransaction>(transactions: T[]): Promise<(Transaction | VersionedTransaction)[]>;
53
- internalSignAndSendTransaction<T extends Transaction | VersionedTransaction>(transaction: T, options?: SendOptions): Promise<string>;
54
- signAndSendTransaction<T extends Transaction | VersionedTransaction>(transaction: T, options?: SendOptions): Promise<string>;
55
- getSigner(): Promise<ISolanaSigner>;
56
- getWalletClientByAddress({ accountAddress, }: {
57
- accountAddress: string;
58
- }): Connection;
59
- exportPrivateKey({ accountAddress, displayContainer, password, }?: {
60
- accountAddress?: string;
61
- displayContainer?: HTMLIFrameElement;
62
- password?: string;
43
+ importPrivateKey({ privateKey, thresholdSignatureScheme, }: {
44
+ privateKey: string;
45
+ thresholdSignatureScheme?: string | undefined;
63
46
  }): Promise<void>;
47
+ exportPrivateKey({ accountAddress, displayContainer, password, }?: {
48
+ accountAddress?: string | undefined;
49
+ displayContainer?: HTMLIFrameElement | undefined;
50
+ password?: string | undefined;
51
+ } | undefined): Promise<void>;
64
52
  getExportHandler(): {
65
53
  clear: () => void;
66
54
  };
67
- importPrivateKey({ privateKey, thresholdSignatureScheme, }: {
68
- privateKey: string;
69
- thresholdSignatureScheme?: string;
55
+ exportClientKeyshares({ accountAddress, password, }: {
56
+ accountAddress: string;
57
+ password?: string | undefined;
70
58
  }): Promise<void>;
71
59
  backupKeySharesToGoogleDrive({ accountAddress, password, }: {
72
60
  accountAddress: string;
73
- password?: string;
61
+ password?: string | undefined;
74
62
  }): Promise<void>;
75
63
  refreshWalletAccountShares({ accountAddress, password, }: {
76
64
  accountAddress: string;
77
- password?: string;
65
+ password?: string | undefined;
78
66
  }): Promise<void>;
79
67
  updatePassword({ accountAddress, existingPassword, newPassword, }: {
80
68
  accountAddress: string;
81
69
  existingPassword: string;
82
70
  newPassword: string;
83
71
  }): Promise<void>;
84
- signRawMessage({ accountAddress, message, }: {
72
+ signRawMessage({ accountAddress, message, password, }: {
85
73
  accountAddress: string;
86
74
  message: string;
75
+ password?: string | undefined;
87
76
  }): Promise<string>;
77
+ endSession(): Promise<void>;
78
+ getActiveAccountAddress(): Promise<string | undefined>;
79
+ }) & typeof SolanaWalletConnector;
80
+ export declare class DynamicWaasSVMConnector extends DynamicWaasSVMConnector_base implements IDynamicWaasConnector {
81
+ connect(): Promise<void>;
82
+ name: string;
83
+ overrideKey: string;
84
+ isEmbeddedWallet: boolean;
85
+ activeAccountAddress: string | undefined;
86
+ protected walletUiUtils: WalletUiUtils<InternalWalletConnector>;
87
+ constructor(props: DynamicWaasSVMConnectorProps);
88
+ private setActiveAccountAddress;
89
+ getActiveAccountAddress(): Promise<string | undefined>;
90
+ validateActiveWallet(expectedAddress: string): Promise<void>;
91
+ internalSignMessage(message: string): Promise<string>;
92
+ signMessage(message: string): Promise<string>;
93
+ internalSignTransaction<T extends Transaction | VersionedTransaction>(transaction: T): Promise<Transaction | VersionedTransaction>;
94
+ signTransaction<T extends Transaction | VersionedTransaction>(transaction: T): Promise<Transaction | VersionedTransaction>;
95
+ internalSignAllTransactions<T extends Transaction | VersionedTransaction>(transactions: T[]): Promise<(Transaction | VersionedTransaction)[]>;
96
+ signAllTransactions<T extends Transaction | VersionedTransaction>(transactions: T[]): Promise<(Transaction | VersionedTransaction)[]>;
97
+ internalSignAndSendTransaction<T extends Transaction | VersionedTransaction>(transaction: T, options?: SendOptions): Promise<string>;
98
+ signAndSendTransaction<T extends Transaction | VersionedTransaction>(transaction: T, options?: SendOptions): Promise<string>;
99
+ getSigner(): Promise<ISolanaSigner>;
100
+ getWalletClientByAddress({ accountAddress, }: {
101
+ accountAddress: string;
102
+ }): Connection;
88
103
  exportClientKeyshares({ accountAddress, password, }: {
89
104
  accountAddress: string;
90
105
  password?: string;
@@ -8,21 +8,6 @@ import { isSameAddress } from '@dynamic-labs/wallet-connector-core';
8
8
  import { logger } from '../../utils/logger.js';
9
9
  import { DynamicWaasSVMSigner } from '../signer/DynamicWaasSVMSigner.js';
10
10
 
11
- // This will need to be moved to a base class once we have base classes for waas connectors
12
- class WaasExportHandler {
13
- constructor() {
14
- this.iframeStamper = null;
15
- }
16
- setIframeStamper(iframe) {
17
- this.iframeStamper = iframe;
18
- }
19
- clear() {
20
- if (this.iframeStamper) {
21
- this.iframeStamper.remove();
22
- this.iframeStamper = null;
23
- }
24
- }
25
- }
26
11
  class DynamicWaasSVMConnector extends withDynamicWaas(SolanaWalletConnector) {
27
12
  connect() {
28
13
  throw new Error('Method not implemented.');
@@ -33,16 +18,23 @@ class DynamicWaasSVMConnector extends withDynamicWaas(SolanaWalletConnector) {
33
18
  this.overrideKey = 'dynamicwaas';
34
19
  this.isEmbeddedWallet = true;
35
20
  this.walletUiUtils = props.walletUiUtils;
36
- this.__exportHandler = new WaasExportHandler();
37
21
  }
38
22
  setActiveAccountAddress(accountAddress) {
39
23
  this.activeAccountAddress = accountAddress;
40
24
  }
25
+ getActiveAccountAddress() {
26
+ return __awaiter(this, void 0, void 0, function* () {
27
+ return this.activeAccountAddress;
28
+ });
29
+ }
41
30
  validateActiveWallet(expectedAddress) {
42
31
  return __awaiter(this, void 0, void 0, function* () {
43
32
  var _a, _b;
44
33
  const walletClient = yield this.getWaasWalletClient();
45
34
  const signedSessionId = yield ((_a = this.getSignedSessionId) === null || _a === void 0 ? void 0 : _a.call(this));
35
+ if (!signedSessionId) {
36
+ throw new DynamicError('Signed session ID is required');
37
+ }
46
38
  const targetWallet = yield walletClient.getWallet({
47
39
  accountAddress: expectedAddress,
48
40
  authToken: (_b = this.getAuthToken) === null || _b === void 0 ? void 0 : _b.call(this),
@@ -57,31 +49,23 @@ class DynamicWaasSVMConnector extends withDynamicWaas(SolanaWalletConnector) {
57
49
  }
58
50
  });
59
51
  }
60
- createWalletAccount() {
61
- return __awaiter(this, arguments, void 0, function* ({ thresholdSignatureScheme = 'TWO_OF_TWO', } = {}) {
62
- var _a, _b;
63
- const walletClient = yield this.getWaasWalletClient();
64
- const signedSessionId = yield ((_a = this.getSignedSessionId) === null || _a === void 0 ? void 0 : _a.call(this));
65
- const createdWallet = yield walletClient.createWalletAccount({
66
- authToken: (_b = this.getAuthToken) === null || _b === void 0 ? void 0 : _b.call(this),
67
- signedSessionId,
68
- thresholdSignatureScheme: thresholdSignatureScheme,
69
- });
70
- return createdWallet;
71
- });
72
- }
73
52
  internalSignMessage(message) {
74
53
  return __awaiter(this, void 0, void 0, function* () {
75
- var _a, _b;
54
+ var _a, _b, _c;
76
55
  const walletClient = yield this.getWaasWalletClient();
77
56
  if (!this.activeAccountAddress) {
78
57
  throw new Error('Active account address is required');
79
58
  }
80
59
  const signedSessionId = yield ((_a = this.getSignedSessionId) === null || _a === void 0 ? void 0 : _a.call(this));
60
+ if (!signedSessionId) {
61
+ throw new DynamicError('Signed session ID is required');
62
+ }
63
+ const mfaToken = yield ((_b = this.getMfaToken) === null || _b === void 0 ? void 0 : _b.call(this));
81
64
  const signedMessage = yield walletClient.signMessage({
82
65
  accountAddress: this.activeAccountAddress,
83
- authToken: (_b = this.getAuthToken) === null || _b === void 0 ? void 0 : _b.call(this),
66
+ authToken: (_c = this.getAuthToken) === null || _c === void 0 ? void 0 : _c.call(this),
84
67
  message,
68
+ mfaToken,
85
69
  signedSessionId,
86
70
  });
87
71
  return signedMessage;
@@ -101,18 +85,23 @@ class DynamicWaasSVMConnector extends withDynamicWaas(SolanaWalletConnector) {
101
85
  }
102
86
  internalSignTransaction(transaction) {
103
87
  return __awaiter(this, void 0, void 0, function* () {
104
- var _a, _b;
88
+ var _a, _b, _c;
105
89
  const walletClient = yield this.getWaasWalletClient();
106
90
  const signedSessionId = yield ((_a = this.getSignedSessionId) === null || _a === void 0 ? void 0 : _a.call(this));
91
+ if (!signedSessionId) {
92
+ throw new DynamicError('Signed session ID is required');
93
+ }
107
94
  if (!this.activeAccountAddress) {
108
95
  throw new Error('Active account address is required');
109
96
  }
97
+ const mfaToken = yield ((_b = this.getMfaToken) === null || _b === void 0 ? void 0 : _b.call(this));
110
98
  const messageBytes = transaction instanceof Transaction
111
99
  ? transaction.serializeMessage()
112
100
  : transaction.message.serialize();
113
101
  const messageToSign = Buffer.from(messageBytes).toString('hex');
114
102
  const signature = yield walletClient.signTransaction({
115
- authToken: (_b = this.getAuthToken) === null || _b === void 0 ? void 0 : _b.call(this),
103
+ authToken: (_c = this.getAuthToken) === null || _c === void 0 ? void 0 : _c.call(this),
104
+ mfaToken,
116
105
  senderAddress: this.activeAccountAddress,
117
106
  signedSessionId,
118
107
  transaction: messageToSign,
@@ -224,114 +213,19 @@ class DynamicWaasSVMConnector extends withDynamicWaas(SolanaWalletConnector) {
224
213
  this.setActiveAccountAddress(accountAddress);
225
214
  return this.getWalletClient();
226
215
  }
227
- exportPrivateKey() {
228
- return __awaiter(this, arguments, void 0, function* ({ accountAddress, displayContainer, password, } = {}) {
229
- var _a;
230
- const walletClient = yield this.getWaasWalletClient();
231
- const targetAccountAddress = accountAddress || this.activeAccountAddress;
232
- if (!targetAccountAddress) {
233
- throw new Error('Account address is required');
234
- }
235
- if (!displayContainer) {
236
- throw new Error('Missing display container for export private key');
237
- }
238
- this.__exportHandler.setIframeStamper(displayContainer);
239
- yield walletClient.exportPrivateKey({
240
- accountAddress: targetAccountAddress,
241
- authToken: (_a = this.getAuthToken) === null || _a === void 0 ? void 0 : _a.call(this),
242
- displayContainer,
243
- password,
244
- });
245
- });
246
- }
247
- getExportHandler() {
248
- return this.__exportHandler;
249
- }
250
- importPrivateKey(_a) {
251
- return __awaiter(this, arguments, void 0, function* ({ privateKey, thresholdSignatureScheme = 'TWO_OF_TWO', }) {
252
- var _b, _c;
253
- const walletClient = yield this.getWaasWalletClient();
254
- const signedSessionId = yield ((_b = this.getSignedSessionId) === null || _b === void 0 ? void 0 : _b.call(this));
255
- if (!signedSessionId) {
256
- throw new Error('Signed session ID is required');
257
- }
258
- yield walletClient.importPrivateKey({
259
- authToken: (_c = this.getAuthToken) === null || _c === void 0 ? void 0 : _c.call(this),
260
- privateKey,
261
- signedSessionId,
262
- thresholdSignatureScheme: thresholdSignatureScheme,
263
- });
264
- });
265
- }
266
- backupKeySharesToGoogleDrive(_a) {
267
- return __awaiter(this, arguments, void 0, function* ({ accountAddress, password, }) {
268
- if (!accountAddress) {
269
- throw new Error('Account address is required');
270
- }
271
- const walletClient = yield this.getWaasWalletClient();
272
- return walletClient.backupKeySharesToGoogleDrive({
273
- accountAddress,
274
- password,
275
- });
276
- });
277
- }
278
- refreshWalletAccountShares(_a) {
279
- return __awaiter(this, arguments, void 0, function* ({ accountAddress, password, }) {
280
- if (!accountAddress) {
281
- throw new Error('Account address is required');
282
- }
283
- const walletClient = yield this.getWaasWalletClient();
284
- return walletClient.refreshWalletAccountShares({
285
- accountAddress,
286
- password,
287
- });
288
- });
289
- }
290
- updatePassword(_a) {
291
- return __awaiter(this, arguments, void 0, function* ({ accountAddress, existingPassword, newPassword, }) {
292
- if (!accountAddress) {
293
- throw new Error('Account address is required');
294
- }
295
- const walletClient = yield this.getWaasWalletClient();
296
- return walletClient.updatePassword({
297
- accountAddress,
298
- existingPassword,
299
- newPassword,
300
- });
301
- });
302
- }
303
- signRawMessage(_a) {
304
- return __awaiter(this, arguments, void 0, function* ({ accountAddress, message, }) {
305
- if (!accountAddress) {
306
- throw new Error('Account address is required');
307
- }
308
- if (message.length !== 64) {
309
- throw new Error('Message must be 64 characters long');
310
- }
311
- const walletClient = yield this.getWaasWalletClient();
312
- return walletClient.signRawMessage({
313
- accountAddress,
314
- message,
315
- });
316
- });
317
- }
216
+ // Chain-specific override for exportClientKeyshares - SVM needs to handle optional account address
318
217
  exportClientKeyshares(_a) {
218
+ const _super = Object.create(null, {
219
+ exportClientKeyshares: { get: () => super.exportClientKeyshares }
220
+ });
319
221
  return __awaiter(this, arguments, void 0, function* ({ accountAddress, password, }) {
320
- var _b, _c;
321
- const walletClient = yield this.getWaasWalletClient();
322
222
  const targetAccountAddress = accountAddress || this.activeAccountAddress;
323
- const signedSessionId = yield ((_b = this.getSignedSessionId) === null || _b === void 0 ? void 0 : _b.call(this));
324
223
  if (!targetAccountAddress) {
325
224
  throw new Error('Account address is required');
326
225
  }
327
- if (!signedSessionId) {
328
- throw new Error('Signed session ID is required');
329
- }
330
- yield walletClient.exportClientKeyshares({
226
+ return _super.exportClientKeyshares.call(this, {
331
227
  accountAddress: targetAccountAddress,
332
- authToken: (_c = this.getAuthToken) === null || _c === void 0 ? void 0 : _c.call(this),
333
228
  password,
334
- signedSessionId,
335
229
  });
336
230
  });
337
231
  }
@@ -351,12 +245,11 @@ class DynamicWaasSVMConnector extends withDynamicWaas(SolanaWalletConnector) {
351
245
  });
352
246
  }
353
247
  endSession() {
248
+ const _super = Object.create(null, {
249
+ endSession: { get: () => super.endSession }
250
+ });
354
251
  return __awaiter(this, void 0, void 0, function* () {
355
- const waasSvmClient = yield this.getWaasWalletClient();
356
- if (!waasSvmClient) {
357
- return;
358
- }
359
- yield waasSvmClient.cleanup();
252
+ yield _super.endSession.call(this);
360
253
  });
361
254
  }
362
255
  }