@dynamic-labs/waas-svm 4.20.2 → 4.20.3

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,11 @@
1
1
 
2
+ ### [4.20.3](https://github.com/dynamic-labs/dynamic-auth/compare/v4.20.2...v4.20.3) (2025-06-13)
3
+
4
+
5
+ ### Bug Fixes
6
+
7
+ * use minified jwt for waas wallet client auth ([#8938](https://github.com/dynamic-labs/dynamic-auth/issues/8938)) ([f7b9e14](https://github.com/dynamic-labs/dynamic-auth/commit/f7b9e1435e397a64fdf4f42f9b3ad354314e0191))
8
+
2
9
  ### [4.20.2](https://github.com/dynamic-labs/dynamic-auth/compare/v4.20.1...v4.20.2) (2025-06-11)
3
10
 
4
11
 
package/package.cjs CHANGED
@@ -3,6 +3,6 @@
3
3
 
4
4
  Object.defineProperty(exports, '__esModule', { value: true });
5
5
 
6
- var version = "4.20.2";
6
+ var version = "4.20.3";
7
7
 
8
8
  exports.version = version;
package/package.js CHANGED
@@ -1,4 +1,4 @@
1
1
  'use client'
2
- var version = "4.20.2";
2
+ var version = "4.20.3";
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.20.2",
3
+ "version": "4.20.3",
4
4
  "description": "A React SDK for implementing wallet web3 authentication and authorization to your website.",
5
5
  "author": "Dynamic Labs, Inc.",
6
6
  "license": "MIT",
@@ -18,17 +18,17 @@
18
18
  },
19
19
  "homepage": "https://www.dynamic.xyz/",
20
20
  "dependencies": {
21
- "@dynamic-labs-wallet/browser-wallet-client": "0.0.85",
22
21
  "@solana/web3.js": "1.98.1",
23
22
  "eventemitter3": "5.0.1",
24
23
  "bs58": "5.0.0",
25
- "@dynamic-labs/assert-package-version": "4.20.2",
26
- "@dynamic-labs/logger": "4.20.2",
27
- "@dynamic-labs/rpc-providers": "4.20.2",
28
- "@dynamic-labs/solana-core": "4.20.2",
29
- "@dynamic-labs/types": "4.20.2",
30
- "@dynamic-labs/utils": "4.20.2",
31
- "@dynamic-labs/wallet-connector-core": "4.20.2"
24
+ "@dynamic-labs/assert-package-version": "4.20.3",
25
+ "@dynamic-labs/logger": "4.20.3",
26
+ "@dynamic-labs/rpc-providers": "4.20.3",
27
+ "@dynamic-labs/solana-core": "4.20.3",
28
+ "@dynamic-labs/types": "4.20.3",
29
+ "@dynamic-labs/utils": "4.20.3",
30
+ "@dynamic-labs/waas": "4.20.3",
31
+ "@dynamic-labs/wallet-connector-core": "4.20.3"
32
32
  },
33
33
  "peerDependencies": {}
34
34
  }
@@ -4,11 +4,11 @@
4
4
  Object.defineProperty(exports, '__esModule', { value: true });
5
5
 
6
6
  var _tslib = require('../../_virtual/_tslib.cjs');
7
- var browserWalletClient = require('@dynamic-labs-wallet/browser-wallet-client');
8
7
  var web3_js = require('@solana/web3.js');
9
8
  var solanaCore = require('@dynamic-labs/solana-core');
10
9
  var utils = require('@dynamic-labs/utils');
11
10
  var walletConnectorCore = require('@dynamic-labs/wallet-connector-core');
11
+ var waas = require('@dynamic-labs/waas');
12
12
  var logger = require('../../utils/logger.cjs');
13
13
  var DynamicWaasSVMSigner = require('../signer/DynamicWaasSVMSigner.cjs');
14
14
 
@@ -27,7 +27,7 @@ class WaasExportHandler {
27
27
  }
28
28
  }
29
29
  }
30
- class DynamicWaasSVMConnector extends solanaCore.SolanaWalletConnector {
30
+ class DynamicWaasSVMConnector extends waas.withDynamicWaas(solanaCore.SolanaWalletConnector) {
31
31
  connect() {
32
32
  throw new Error('Method not implemented.');
33
33
  }
@@ -39,49 +39,17 @@ class DynamicWaasSVMConnector extends solanaCore.SolanaWalletConnector {
39
39
  this.walletUiUtils = props.walletUiUtils;
40
40
  this.__exportHandler = new WaasExportHandler();
41
41
  }
42
- setGetAuthTokenFunction(getAuthToken) {
43
- this.getAuthToken = getAuthToken;
44
- }
45
- setEnvironmentId(environmentId) {
46
- this.environmentId = environmentId;
47
- }
48
- setBaseApiUrl(baseApiUrl) {
49
- this.baseApiUrl = baseApiUrl;
50
- }
51
- setRelayUrl(relayUrl) {
52
- this.relayUrl = relayUrl;
53
- }
54
42
  setActiveAccountAddress(accountAddress) {
55
43
  this.activeAccountAddress = accountAddress;
56
44
  }
57
- createDynamicWaasClient() {
58
- var _a;
59
- const authToken = (_a = this.getAuthToken) === null || _a === void 0 ? void 0 : _a.call(this);
60
- if (!authToken) {
61
- throw new Error('Auth token is required');
62
- }
63
- if (!this.environmentId) {
64
- throw new Error('Environment ID is required');
65
- }
66
- return new browserWalletClient.DynamicWalletClient({
67
- authToken,
68
- baseApiUrl: this.baseApiUrl || 'api.dynamicauth.xyz',
69
- baseMPCRelayApiUrl: this.relayUrl || 'relay.dynamic-preprod.xyz',
70
- chainName: 'SVM',
71
- environmentId: this.environmentId,
72
- });
73
- }
74
- getWaasWalletClient() {
75
- if (!this.dynamicWaasClient) {
76
- this.dynamicWaasClient = this.createDynamicWaasClient();
77
- }
78
- return this.dynamicWaasClient;
79
- }
80
45
  validateActiveWallet(expectedAddress) {
81
46
  return _tslib.__awaiter(this, void 0, void 0, function* () {
47
+ var _a;
82
48
  const walletClient = this.getWaasWalletClient();
49
+ const signedSessionId = yield ((_a = this.getSignedSessionId) === null || _a === void 0 ? void 0 : _a.call(this));
83
50
  const targetWallet = yield walletClient.getWallet({
84
51
  accountAddress: expectedAddress,
52
+ signedSessionId,
85
53
  });
86
54
  if (!targetWallet) {
87
55
  throw new utils.DynamicError('Account not found');
@@ -94,8 +62,11 @@ class DynamicWaasSVMConnector extends solanaCore.SolanaWalletConnector {
94
62
  }
95
63
  createWalletAccount() {
96
64
  return _tslib.__awaiter(this, arguments, void 0, function* ({ thresholdSignatureScheme = 'TWO_OF_TWO', } = {}) {
65
+ var _a;
97
66
  const walletClient = this.getWaasWalletClient();
67
+ const signedSessionId = yield ((_a = this.getSignedSessionId) === null || _a === void 0 ? void 0 : _a.call(this));
98
68
  const createdWallet = yield walletClient.createWalletAccount({
69
+ signedSessionId,
99
70
  thresholdSignatureScheme: thresholdSignatureScheme,
100
71
  });
101
72
  return createdWallet;
@@ -103,13 +74,16 @@ class DynamicWaasSVMConnector extends solanaCore.SolanaWalletConnector {
103
74
  }
104
75
  internalSignMessage(message) {
105
76
  return _tslib.__awaiter(this, void 0, void 0, function* () {
77
+ var _a;
106
78
  const walletClient = this.getWaasWalletClient();
107
79
  if (!this.activeAccountAddress) {
108
80
  throw new Error('Active account address is required');
109
81
  }
82
+ const signedSessionId = yield ((_a = this.getSignedSessionId) === null || _a === void 0 ? void 0 : _a.call(this));
110
83
  const signedMessage = yield walletClient.signMessage({
111
84
  accountAddress: this.activeAccountAddress,
112
85
  message,
86
+ signedSessionId,
113
87
  });
114
88
  return signedMessage;
115
89
  });
@@ -128,7 +102,9 @@ class DynamicWaasSVMConnector extends solanaCore.SolanaWalletConnector {
128
102
  }
129
103
  internalSignTransaction(transaction) {
130
104
  return _tslib.__awaiter(this, void 0, void 0, function* () {
105
+ var _a;
131
106
  const walletClient = this.getWaasWalletClient();
107
+ const signedSessionId = yield ((_a = this.getSignedSessionId) === null || _a === void 0 ? void 0 : _a.call(this));
132
108
  if (!this.activeAccountAddress) {
133
109
  throw new Error('Active account address is required');
134
110
  }
@@ -138,6 +114,7 @@ class DynamicWaasSVMConnector extends solanaCore.SolanaWalletConnector {
138
114
  const messageToSign = Buffer.from(messageBytes).toString('hex');
139
115
  const signature = yield walletClient.signTransaction({
140
116
  senderAddress: this.activeAccountAddress,
117
+ signedSessionId,
141
118
  transaction: messageToSign,
142
119
  });
143
120
  transaction.addSignature(new web3_js.PublicKey(this.activeAccountAddress), Buffer.from(signature, 'hex'));
@@ -331,14 +308,20 @@ class DynamicWaasSVMConnector extends solanaCore.SolanaWalletConnector {
331
308
  }
332
309
  exportClientKeyshares(_a) {
333
310
  return _tslib.__awaiter(this, arguments, void 0, function* ({ accountAddress, password, }) {
311
+ var _b;
334
312
  const walletClient = this.getWaasWalletClient();
335
313
  const targetAccountAddress = accountAddress || this.activeAccountAddress;
314
+ const signedSessionId = yield ((_b = this.getSignedSessionId) === null || _b === void 0 ? void 0 : _b.call(this));
336
315
  if (!targetAccountAddress) {
337
316
  throw new Error('Account address is required');
338
317
  }
318
+ if (!signedSessionId) {
319
+ throw new Error('Signed session ID is required');
320
+ }
339
321
  yield walletClient.exportClientKeyshares({
340
322
  accountAddress: targetAccountAddress,
341
323
  password,
324
+ signedSessionId,
342
325
  });
343
326
  });
344
327
  }
@@ -1,4 +1,3 @@
1
- import { DynamicWalletClient } from '@dynamic-labs-wallet/browser-wallet-client';
2
1
  import { Connection, SendOptions, Transaction, VersionedTransaction } from '@solana/web3.js';
3
2
  import { ISolanaSigner, SolanaWalletConnector, SolanaWalletConnectorOpts } from '@dynamic-labs/solana-core';
4
3
  import { IUITransaction, WalletUiUtils } from '@dynamic-labs/types';
@@ -6,27 +5,36 @@ import { IDynamicWaasConnector, InternalWalletConnector } from '@dynamic-labs/wa
6
5
  export type DynamicWaasSVMConnectorProps = SolanaWalletConnectorOpts & {
7
6
  walletUiUtils: WalletUiUtils<InternalWalletConnector>;
8
7
  };
9
- export declare class DynamicWaasSVMConnector extends SolanaWalletConnector implements IDynamicWaasConnector {
8
+ declare const DynamicWaasSVMConnector_base: (abstract new (...args: any[]) => {
9
+ [x: string]: any;
10
+ name: string;
11
+ overrideKey: string;
12
+ isEmbeddedWallet: boolean;
13
+ getSignedSessionId?: (() => Promise<string>) | undefined;
14
+ getAuthToken?: (() => string) | undefined;
15
+ environmentId?: string | undefined;
16
+ baseApiUrl?: string | undefined;
17
+ relayUrl?: string | undefined;
18
+ dynamicWaasClient: import("@dynamic-labs-wallet/browser-wallet-client").DynamicWalletClient | undefined;
19
+ chainName: string;
20
+ setGetAuthTokenFunction(getAuthToken: () => string): void;
21
+ setEnvironmentId(environmentId: string): void;
22
+ setBaseApiUrl(baseApiUrl: string): void;
23
+ setRelayUrl(relayUrl: string): void;
24
+ setGetSignedSessionIdFunction(getSignedSessionId: () => Promise<string>): void;
25
+ createDynamicWaasClient(): import("@dynamic-labs-wallet/browser-wallet-client").DynamicWalletClient;
26
+ getWaasWalletClient(): import("@dynamic-labs-wallet/browser-wallet-client").DynamicWalletClient;
27
+ }) & typeof SolanaWalletConnector;
28
+ export declare class DynamicWaasSVMConnector extends DynamicWaasSVMConnector_base implements IDynamicWaasConnector {
10
29
  connect(): Promise<void>;
11
30
  name: string;
12
31
  overrideKey: string;
13
32
  isEmbeddedWallet: boolean;
14
- private environmentId?;
15
- private getAuthToken?;
16
- private dynamicWaasClient;
17
33
  private __exportHandler;
18
34
  activeAccountAddress: string | undefined;
19
- private baseApiUrl?;
20
- private relayUrl?;
21
35
  protected walletUiUtils: WalletUiUtils<InternalWalletConnector>;
22
36
  constructor(props: DynamicWaasSVMConnectorProps);
23
- setGetAuthTokenFunction(getAuthToken: () => string): void;
24
- setEnvironmentId(environmentId: string): void;
25
- setBaseApiUrl(baseApiUrl: string): void;
26
- setRelayUrl(relayUrl: string): void;
27
37
  private setActiveAccountAddress;
28
- createDynamicWaasClient(): DynamicWalletClient;
29
- private getWaasWalletClient;
30
38
  validateActiveWallet(expectedAddress: string): Promise<void>;
31
39
  createWalletAccount({ thresholdSignatureScheme, }?: {
32
40
  thresholdSignatureScheme?: string;
@@ -84,3 +92,4 @@ export declare class DynamicWaasSVMConnector extends SolanaWalletConnector imple
84
92
  createUiTransaction(from: string): Promise<IUITransaction>;
85
93
  endSession(): Promise<void>;
86
94
  }
95
+ export {};
@@ -1,10 +1,10 @@
1
1
  'use client'
2
2
  import { __awaiter } from '../../_virtual/_tslib.js';
3
- import { DynamicWalletClient } from '@dynamic-labs-wallet/browser-wallet-client';
4
3
  import { Transaction, PublicKey } from '@solana/web3.js';
5
4
  import { SolanaWalletConnector, SolanaUiTransaction } from '@dynamic-labs/solana-core';
6
5
  import { DynamicError } from '@dynamic-labs/utils';
7
6
  import { isSameAddress } from '@dynamic-labs/wallet-connector-core';
7
+ import { withDynamicWaas } from '@dynamic-labs/waas';
8
8
  import { logger } from '../../utils/logger.js';
9
9
  import { DynamicWaasSVMSigner } from '../signer/DynamicWaasSVMSigner.js';
10
10
 
@@ -23,7 +23,7 @@ class WaasExportHandler {
23
23
  }
24
24
  }
25
25
  }
26
- class DynamicWaasSVMConnector extends SolanaWalletConnector {
26
+ class DynamicWaasSVMConnector extends withDynamicWaas(SolanaWalletConnector) {
27
27
  connect() {
28
28
  throw new Error('Method not implemented.');
29
29
  }
@@ -35,49 +35,17 @@ class DynamicWaasSVMConnector extends SolanaWalletConnector {
35
35
  this.walletUiUtils = props.walletUiUtils;
36
36
  this.__exportHandler = new WaasExportHandler();
37
37
  }
38
- setGetAuthTokenFunction(getAuthToken) {
39
- this.getAuthToken = getAuthToken;
40
- }
41
- setEnvironmentId(environmentId) {
42
- this.environmentId = environmentId;
43
- }
44
- setBaseApiUrl(baseApiUrl) {
45
- this.baseApiUrl = baseApiUrl;
46
- }
47
- setRelayUrl(relayUrl) {
48
- this.relayUrl = relayUrl;
49
- }
50
38
  setActiveAccountAddress(accountAddress) {
51
39
  this.activeAccountAddress = accountAddress;
52
40
  }
53
- createDynamicWaasClient() {
54
- var _a;
55
- const authToken = (_a = this.getAuthToken) === null || _a === void 0 ? void 0 : _a.call(this);
56
- if (!authToken) {
57
- throw new Error('Auth token is required');
58
- }
59
- if (!this.environmentId) {
60
- throw new Error('Environment ID is required');
61
- }
62
- return new DynamicWalletClient({
63
- authToken,
64
- baseApiUrl: this.baseApiUrl || 'api.dynamicauth.xyz',
65
- baseMPCRelayApiUrl: this.relayUrl || 'relay.dynamic-preprod.xyz',
66
- chainName: 'SVM',
67
- environmentId: this.environmentId,
68
- });
69
- }
70
- getWaasWalletClient() {
71
- if (!this.dynamicWaasClient) {
72
- this.dynamicWaasClient = this.createDynamicWaasClient();
73
- }
74
- return this.dynamicWaasClient;
75
- }
76
41
  validateActiveWallet(expectedAddress) {
77
42
  return __awaiter(this, void 0, void 0, function* () {
43
+ var _a;
78
44
  const walletClient = this.getWaasWalletClient();
45
+ const signedSessionId = yield ((_a = this.getSignedSessionId) === null || _a === void 0 ? void 0 : _a.call(this));
79
46
  const targetWallet = yield walletClient.getWallet({
80
47
  accountAddress: expectedAddress,
48
+ signedSessionId,
81
49
  });
82
50
  if (!targetWallet) {
83
51
  throw new DynamicError('Account not found');
@@ -90,8 +58,11 @@ class DynamicWaasSVMConnector extends SolanaWalletConnector {
90
58
  }
91
59
  createWalletAccount() {
92
60
  return __awaiter(this, arguments, void 0, function* ({ thresholdSignatureScheme = 'TWO_OF_TWO', } = {}) {
61
+ var _a;
93
62
  const walletClient = this.getWaasWalletClient();
63
+ const signedSessionId = yield ((_a = this.getSignedSessionId) === null || _a === void 0 ? void 0 : _a.call(this));
94
64
  const createdWallet = yield walletClient.createWalletAccount({
65
+ signedSessionId,
95
66
  thresholdSignatureScheme: thresholdSignatureScheme,
96
67
  });
97
68
  return createdWallet;
@@ -99,13 +70,16 @@ class DynamicWaasSVMConnector extends SolanaWalletConnector {
99
70
  }
100
71
  internalSignMessage(message) {
101
72
  return __awaiter(this, void 0, void 0, function* () {
73
+ var _a;
102
74
  const walletClient = this.getWaasWalletClient();
103
75
  if (!this.activeAccountAddress) {
104
76
  throw new Error('Active account address is required');
105
77
  }
78
+ const signedSessionId = yield ((_a = this.getSignedSessionId) === null || _a === void 0 ? void 0 : _a.call(this));
106
79
  const signedMessage = yield walletClient.signMessage({
107
80
  accountAddress: this.activeAccountAddress,
108
81
  message,
82
+ signedSessionId,
109
83
  });
110
84
  return signedMessage;
111
85
  });
@@ -124,7 +98,9 @@ class DynamicWaasSVMConnector extends SolanaWalletConnector {
124
98
  }
125
99
  internalSignTransaction(transaction) {
126
100
  return __awaiter(this, void 0, void 0, function* () {
101
+ var _a;
127
102
  const walletClient = this.getWaasWalletClient();
103
+ const signedSessionId = yield ((_a = this.getSignedSessionId) === null || _a === void 0 ? void 0 : _a.call(this));
128
104
  if (!this.activeAccountAddress) {
129
105
  throw new Error('Active account address is required');
130
106
  }
@@ -134,6 +110,7 @@ class DynamicWaasSVMConnector extends SolanaWalletConnector {
134
110
  const messageToSign = Buffer.from(messageBytes).toString('hex');
135
111
  const signature = yield walletClient.signTransaction({
136
112
  senderAddress: this.activeAccountAddress,
113
+ signedSessionId,
137
114
  transaction: messageToSign,
138
115
  });
139
116
  transaction.addSignature(new PublicKey(this.activeAccountAddress), Buffer.from(signature, 'hex'));
@@ -327,14 +304,20 @@ class DynamicWaasSVMConnector extends SolanaWalletConnector {
327
304
  }
328
305
  exportClientKeyshares(_a) {
329
306
  return __awaiter(this, arguments, void 0, function* ({ accountAddress, password, }) {
307
+ var _b;
330
308
  const walletClient = this.getWaasWalletClient();
331
309
  const targetAccountAddress = accountAddress || this.activeAccountAddress;
310
+ const signedSessionId = yield ((_b = this.getSignedSessionId) === null || _b === void 0 ? void 0 : _b.call(this));
332
311
  if (!targetAccountAddress) {
333
312
  throw new Error('Account address is required');
334
313
  }
314
+ if (!signedSessionId) {
315
+ throw new Error('Signed session ID is required');
316
+ }
335
317
  yield walletClient.exportClientKeyshares({
336
318
  accountAddress: targetAccountAddress,
337
319
  password,
320
+ signedSessionId,
338
321
  });
339
322
  });
340
323
  }